Sql not returning all results
Posted: Fri Oct 23, 2009 7:29 pm
Hi all,
Can some one please tell me why the following code would not return all results.
ie the the column has x results it is returning x-1 all the time.
Please Help
Been looking at it way too long.
Can some one please tell me why the following code would not return all results.
Code: Select all
<form action='#' method='post' id="search">
Search For An Incident By Date:
<select name="find">
<?php
require_once ('mysql_connect.php'); // Connect to the db.
$sql = "SELECT idate FROM report ORDER BY `idate` DESC";
$query = mysql_query($sql);
$data = mysql_fetch_array($query);
while($data = mysql_fetch_array($query)){
echo "<option value=\"" . $data ['idate'] . "\">" . $data ['idate'] . "</option>";
}
?>
</select>
<input type="submit" name="submit" value="Search">
<input type="hidden" name="submitted" value="TRUE" />
</form>Please Help
Been looking at it way too long.