Thanks for your quick reply.
I did try with the single quotes before posting here and it didn't work. But since as you said I was doing two consecutive calls I said well let's see! LOL
It still does not work and I am wondering why the heck it prints out the messages:
"No Ads meet the date you entered.
The date entered was: 2007-03-05 00:00:00"
before it even prints out the headings! The headings are in code before the loop for the query.
<table>
<tr>
<td><strong>Title</strong></td>
<td><strong>Description</strong></td>
</tr>
// ?php
// Format incoming date to correct format
$year = $_GET['yr'];
$month = $_GET['mth'];
$day = $_GET['day'];
$hour = 00;
$min = 00;
$sec = 00;
// use mktime for changing to UNIX time
$dspdate = mktime(0, 0, 0, $month, $day, $year);
$displaydate = date("Y-m-d H:i:s", $dspdate);
$sql = "SELECT * FROM classifieds WHERE starts = '$displaydate'";
$result= mysql_query($sql) or die("Query failed ($sql): " . mysql_error());
/* Retrieves the rows from the query result set and puts them into a HTML table row */
if(mysql_num_rows($result))
{
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo("<tr><td>" . $row['title'] . "</td>");
echo "<td>" . $row['description'] . "</td>";
echo "<td><a href=\"ad.php?id=".$row[id]."\">View</a></td></tr>";
} // end while
}
else
{
// no matches found
echo("<p>No Ads meet the date you entered.</p>");
echo("<p>The date entered was: $displaydate</p>");
} // end if
/* Closes the table */
P.S. The errors will not show up on my server anyway, they are turned off. :queasy:
I also know I should only be selecting the id, title and description since that is all I am using.