View Single Post
Old 02-17-2008, 07:15 AM   #4 (permalink)
SOCK
The Acquainted
 
Join Date: Nov 2007
Posts: 154
Thanks: 31
SOCK is on a distinguished road
Default

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 ( $rowmysql_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.
__________________
I reject your reality, and substitute my own.
SOCK is offline  
Reply With Quote