PHP Code:
<select><?php dyn_dropdown(tbl_status,status); ?></select>
You say this is how you're calling the function? Is that an example or is that your actual code? If so, you're passing (probably) undefined constants to the function, not values. Wrap those parameters in quotes.
This conditional probably doesn't work as you expect:
PHP Code:
if(mysql_num_rows($query)) { }
mysql_num_rows() returns either the
number of records returned in the resultset, or
FALSE.
It doesn't return TRUE as your conditional assumes. So if it returns anything other than FALSE, 0 or 1, that conditional statement breaks.
I'm also curious as to why you're not using the `id` column as the OPTION tag value, e.g.
PHP Code:
while ( $row= mysql_fetch_assoc($query) ) {
echo "<option value={$row['id']}>{$row['columnname']}</option>";
}
Otherwise, how is the SELECT dropdown going to function and relate to your database? Speaking of which, how is this going to work if you use
$columnname in the SELECT and
$row['columnname'] in the output? You need to use
$columnname in both instances, or use a hardcoded column name (no pun intended) in both.