I have created a table in my website database named Events. I made a date field named End_date to indicated the last date I want the row associated with that date to display on my page.
My code to perform a select of all table rows (listed below works fine. However, I have tried many ways to limit my search to rows with and end date greater than the current date. Each time, I get error messages telling mr the "Supplied argument is not a valid MySQL result resource"
My code for selecting all statements is:
$Current_date = date("dd,mm,yy"
;
Echo $Current_date;
$sql = "SELECT * FROM Events ";
$result = mysql_query($sql);
$color1 = "#ff6699";
$color2 = "#BFD8BC";
$row_count = 0;
$row_count1 = 0;
$num=mysql_numrows($result);
echo("Total entries $num <br>"
;
//Send fetch loop
While ($row = mysql_fetch_array($result)) {
$Event_date = $row['Event_date'];
$Description = $row['Description'];
$End_date = $row['End_date'];
Works;
I have tried to modify the SELECT statement to:
$sql = "SELECT * FROM Events WHERE $Current_date < 'End_date' ";
Returns errors
What an I doing wrong? Thanks in advance for your help.
My code to perform a select of all table rows (listed below works fine. However, I have tried many ways to limit my search to rows with and end date greater than the current date. Each time, I get error messages telling mr the "Supplied argument is not a valid MySQL result resource"
My code for selecting all statements is:
$Current_date = date("dd,mm,yy"
Echo $Current_date;
$sql = "SELECT * FROM Events ";
$result = mysql_query($sql);
$color1 = "#ff6699";
$color2 = "#BFD8BC";
$row_count = 0;
$row_count1 = 0;
$num=mysql_numrows($result);
echo("Total entries $num <br>"
//Send fetch loop
While ($row = mysql_fetch_array($result)) {
$Event_date = $row['Event_date'];
$Description = $row['Description'];
$End_date = $row['End_date'];
Works;
I have tried to modify the SELECT statement to:
$sql = "SELECT * FROM Events WHERE $Current_date < 'End_date' ";
Returns errors
What an I doing wrong? Thanks in advance for your help.