How can I get the week number of a date by using mysqli for each entry?
Given I have table1
containing a date
column with the following two entries:
2018-03-14
2018-05-14
I wish to see the week numbers of the above two entries. My main problem is that I do not know how to process the result of my query.
$sql = 'SELECT WEEK(date) FROM table1 WHERE YEAR(beginn) = "2018"';
$db_erg = mysqli_query($con, $sql);
while ($row = $db_erg->fetch_array())
{
echo $row[0]; // or $row['week'] if you used AS week
}