I am trying to select all the rows from my database that match the variables $year and $month. In other words, I am trying to select a months worth of reservations.
My database reservation_date column is stored in this format: year-month-day.
I have come up this this code, which does not work:
I am not surprised that this code doesn't work, but I can't think of another way to phrase it. I have tired other various phrases which did not work either.Code:$query="SELECT * FROM $table WHERE reservation_date = $year."-".$month."-". AND day BETWEEN 1 AND 31";
Can someone help me on this, and also tell me where I can learn how to phrase the different queries? I have read many examples in books and on the web, but they are all very simple queries.