Posted by Paul Kaspers on 05/09/06 12:01
Well in fact you only select 1 result, you don't go through the
resultset (more to read on www.php.net look under mysql_fetch_array).
The correct way to handle a db request is below.
function form_MS($formname, $method, $action){
$sql = "SELECT orders.MS FROM orders;";
$result = @mysql_query($sql);
$numrows = @mysql_num_rows($result);
if ($numrows == NULL){
return (false);
}
else
{
echo ("<form name=\"$formname\" method=\"$method\" action=\"$action\">\n");
echo ("<select name=\"MS\">\n");
while ($my_baby = mysql_fetch_array($result)){
echo ("<option
value=\"".$my_baby['orders.MS']."\">".$my_baby['orders.MS']."</option>\n");
}
echo ("</select>\n");
echo ("</form>\n");
}
}
Navigation:
[Reply to this message]
|