Posted by David C. on 09/19/05 11:19
Instead of:
<?
$query="SELECT * FROM table ORDER BY year";
$result = mysql_query($query) or die ("Error in query: $query. "
..mysql_error());
while ($line = mysql_fetch_array($result)) {
print ("<OPTION value=".$line['year']."></OPTION>"); }
?>
Try this:
<?
$query="SELECT * FROM table ORDER BY year";
$result = mysql_query($query) or die ("Error in query: $query. "
..mysql_error());
$num_rows = mysql_num_rows($result);
for ($count = 0; $count < $num_rows; $count++) {
$line = mysql_fetch_array($result);
print ("<OPTION
value=".$line['year'].">".$line['year']."</OPTION>"); }
?>
Navigation:
[Reply to this message]
|