Hi,
I'm trying to produce three drop down select options. Each one contains data from the same table. Yet it only seems to select data from the first query and none of the others unless i do three different queries, e.g:
<?
$db = mysql_connect("localhost");
mysql_select_db("names",$db);
$query = mysql_query("SELECT * FROM name ORDER BY id ASC");
?>
<html>
<body>
<table width="600" cellpadding="0" cellspacing="0">
<tr>
<td><p><b>ID</b></p></td>
<td><p><b>Name</b></p></td>
<td><p><b>Logon</b></p></td>
</tr>
<tr>
<td>
<?
echo "<select name=\"id\" size=\"1\">";
while($result = mysql_fetch_array($query))
{
echo "<option value=\"test.php?id=".$result['id']."\">".$result['id']."</option>";
}
echo "</select>";
?>
</td>
<td>
<?
echo "<select name=\"name\" size=\"1\">";
while($result = mysql_fetch_array($query))
{
echo "<option value=\"".$result['id']."\">".$result['name']."</option>";
}
echo "</select>";
?>
</td>
<td>
<?
echo "<select name=\"logon\" size=\"1\">";
while($result = mysql_fetch_array($query))
{
echo "<option value=\"".$result['id']."\">".$result['logon']."</option>";
}
echo "</select>";
?>
</td>
</tr>
</table>
</body>
</html>
Yet this will only fill the first select box and the other three will be blank, even though they are genuine table rows.
Any ideas?
Cheers
Ant