PDA

View Full Version : Query returning blank


NancyJ
09-21-2006, 12:27 PM
Ok this code has me baffled - this is the code

// dates
$sql = "SELECT * FROM tblSummaryDates WHERE fldSearchType = 'all'";
$result = mysql_query($sql)or die(mysql_error());
while($row = mysql_fetch_assoc($result));
{
echo mysql_num_rows($result)." results found<br />";
print_r($row);
$min = strtotime($row['fldMinDate']);
$max = strtotime($row['fldMaxDate']);
echo $min."<br />";
echo $max;
}

Its quite a simple snippet - it executes a simple query (which I've tested in phpMyAdmin and it works) Then i loop through the results (which there should be only 1 of) and set the variables min and max to be timestamps based on the mySQL Date field values.
This is where it gets weird - the script outputs :

1 results found<br /><br />

and thats it - if a result is found and $row=mysql_fetch_assoc($result) then how can $row be completely blank? It doesnt even print out array() - just nothing at all.

NancyJ
09-21-2006, 12:36 PM
Leaving this here for future idiots like myself ;)
the problem is the ; on the end of the while() statement.... doh!