$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>"; } } } ?> 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>"; } } } ?> 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
Archived
This topic is now archived and is closed to further replies.