Problems with SQL query
Hi,
I am having problems with an SQL query not returning any rows. My table in my database is set up like:
ns_event_month INTEGER
ns_event_day INTEGER
ns_event_year INTEGER
(i'm leaving many fields out)
And here is part of my code. It returns zero rows, however there are 2 records in my database that are 5/6/2005 and 5/7/2005 (m/d/y). So there are 2 archived "events" already, but this query returns nothing.
http://www.welcometothenuclearage.com/shows.php (a link to the page that isn't working correctly)
I am currently displaying all the current shows my band has booked, but I want to show all the past shows. This was working fine until one day, and then it just stopped working. So I'm lost...
Any help is greatly appreciated.
I am having problems with an SQL query not returning any rows. My table in my database is set up like:
ns_event_month INTEGER
ns_event_day INTEGER
ns_event_year INTEGER
(i'm leaving many fields out)
<?php
// Define some variables
$cur_month = date('n');
$cur_day = date('j');
$cur_year = date('Y');
// Execute SQL query
$sql = "SELECT * FROM ns_events WHERE ( ( ns_event_year <= '$cur_year' ) AND ( ns_event_month <= '$cur_month' ) AND ( ns_event_day < '$cur_day' ) ) ";
$sql .= "ORDER BY ns_event_year, ns_event_month, ns_event_day DESC";
$result = @mysql_query($sql, $db_conn) or die('FATAL ERROR: Cannot execute SQL statement:' . mysql_error());
?>
And here is part of my code. It returns zero rows, however there are 2 records in my database that are 5/6/2005 and 5/7/2005 (m/d/y). So there are 2 archived "events" already, but this query returns nothing.
http://www.welcometothenuclearage.com/shows.php (a link to the page that isn't working correctly)
I am currently displaying all the current shows my band has booked, but I want to show all the past shows. This was working fine until one day, and then it just stopped working. So I'm lost...
Any help is greatly appreciated.
