be blank when the user opens the page.
Cheers
Andrew.
- Original Message -
From: "David Rodman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 26, 2004 6:44 AM
Subject: Populating a from a database
> Here's a way to do it with PHP:
>
&
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 "";
echo "---NONE---";
if (mysql_num_rows($result)==0) {
//no files
} else {
while ($row=mysql_fetch_array($result)) {
$ID=$row["ID"]
";
}
}
}
echo "";
}
Note that unless one of the list items has the 'selected' attribute set,
then none of the items in the list will be shown as the "chosen one" in the
list - it will just be blank when the user opens the page.
Cheers
Andrew.
- Origina
Here's a way to do it with PHP:
function field_select($table, $field)
{$result = mysql_query("SELECT $field FROM $table") or
die(mysql_error());
print "\n";
$limit = mysql_num_rows($result);
for($i = 0; $i < $limit; ++$i)
{list($value) = mysql_fetch_array($result);