The week has 7 days, so I want to be able to make a query that the user, depending on which day of the week he chooses, presents the result:
mysql_query("SELECT * FROM tbl_eventos WHERE WEEK(data) = '$semana_atual' AND YEAR(data) = '$ano_atual'");
Now in this query, I want to try to fit the day of the week (
$dia_semana ) that goes from 1 to 7 and that way all the events of that day of the week, week and current year are presented.
That is, if you choose weekday 4, it will list the events of weekday 4, which corresponds to Wednesday.
DAYOFWEEK function on the
data column. It returns the index for the day of the week, where 1 is Sunday, 2 is Monday, and so on.
Source: MySQL documentation