here is how i would do it, a slight change to the if else ..
function filelist($fileID) {
$result=mysql_query("SELECT ID,title,type FROM files");
echo "<BR>";
echo "<select name=\"file\"><option value=\"0\">---NONE---</option>";
if (mysql_num_rows($result)==0) {
//no files
} else {
while ($row=mysql_fetch_array($result)) {
$ID=$row["ID"];
$title=$row["title"];
$type=$row["type"];
echo "<option ".$ID==$fileID ? "selected" : ""." value=\"$ID\">" . $type
. " - " . $title .
"</option>";
}
}
echo "</select><BR>";
}
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]