I am attempting to make a simple classifieds page.
I need to create a record set to be used to display info using PHP & MySQL from a table where the current date is greater then the end date in the table and less then the start date.
-table structure
classified
startdate_cla
enddate_cla
description_cla
i.e. Display ALL form table classified where startdate_cla is less then the current date AND enddate_cla is greater than the current date. This should return everything from the table classified where the curent date is equal to or between the start date & end date.
Here is my code, can anyone suggest how to make this work. I would appreciate it
$today = date("Y-m-d");
$coldate_rsClassified = "-1";
if (isset($today)) {
$coldate_rsClassified = (get_magic_quotes_gpc()) ? $today : addslashes($today);
}
mysql_select_db($database_connCMS, $connCMS);
$query_rsClassified = sprintf("SELECT * FROM classified_ads WHERE enddate_cla > %s ORDER BY ID_cla DESC", $coldate_rsClassified);
$rsClassified = mysql_query($query_rsClassified, $connCMS) or die(mysql_error());
$row_rsClassified = mysql_fetch_assoc($rsClassified);
$totalRows_rsClassified = mysql_num_rows($rsClassified);