unidox Posted September 22, 2007 Share Posted September 22, 2007 My Code: if ($fieldtype[$i] == "selectb") { $r = mysql_fetch_array(mysql_query("SELECT * FROM `cp_divisions` ORDER BY division_id DESC")); $divis[] = $r['division']; echo "<select name=\"" . $field[$i] . "\">"; for ($o = 0; $o < count($r); $o++) { ?> <option value= "<?=$divis[$o]?>"> <?=$divis[$o]?> </option> </select> <? } } Works, but I have more than 1 in the table, how do I echo more than one? Quote Link to comment Share on other sites More sharing options...
unidox Posted September 22, 2007 Author Share Posted September 22, 2007 bump Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted September 22, 2007 Share Posted September 22, 2007 First, only use mysql_query once: $result = mysql_query("your sql here"). Then loop over the result, using mysql_fetch_array() each time, ala: while ($row = mysql_fetch_array($result)) { // Do something with $row here. } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.