$username Posted October 5, 2007 Share Posted October 5, 2007 Hello Guys and Gals, Can this be done with this code. I want both fname and lname to be displayed in the drop down box. <? $sql = "SELECT fname, lname FROM admin ORDER BY `ID` DESC"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { echo "<option value=\"{$row['fname, lname']}\">{$row['fname, lname']}</option>"; } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72014-selecting-2-fields-from-mysql-and-displaying-them-in-php/ Share on other sites More sharing options...
MmmVomit Posted October 5, 2007 Share Posted October 5, 2007 <? $sql = "SELECT fname, lname FROM admin ORDER BY `ID` DESC"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { echo "<option value=\"$row[fname], $row[lname]}\">$row[fname], $row[lname]</option>"; } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72014-selecting-2-fields-from-mysql-and-displaying-them-in-php/#findComment-362819 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.