Raf1k1 Posted February 19, 2010 Share Posted February 19, 2010 I'm having problems trying to populate a list with data from a MySQL DB. So far what I have is this but it's giving me a blank page. <label>Game Title:<span class="typo-1"></span></label> <select class="drop" name="" > <?php // Load in navigation links from the MySQL database $sql = "SELECT game_title FROM xgame"; $result = $conn->query($sql) or die(mysqli_error()); if($result){ while($row = $result->fetch_object()){ echo "<option value="{$row->game_title}">{$row->game_title}</option>"; } } ?> </select> Link to comment https://forums.phpfreaks.com/topic/192650-list-populated-with-mysql-field-data/ Share on other sites More sharing options...
taquitosensei Posted February 19, 2010 Share Posted February 19, 2010 it looks like you've got double quotes in your double quotes echo "<option value="{$row->game_title}">{$row->game_title}</option>"; should probably be more like this echo "<option value='{$row->game_title}'>{$row->game_title}</option>"; blank page can mean that you're getting a fatal error but display_errors is turned off you can put this at the top of your script while you're developing so you can see the errors ini_set("display_errors","1"); ERROR_REPORTING(E_ALL); Link to comment https://forums.phpfreaks.com/topic/192650-list-populated-with-mysql-field-data/#findComment-1014922 Share on other sites More sharing options...
Raf1k1 Posted February 19, 2010 Author Share Posted February 19, 2010 I could swear I tried that before. I've been googling for the past 2 hours and trying all sorts of different things. Thanks a lot though. It worked a treat Link to comment https://forums.phpfreaks.com/topic/192650-list-populated-with-mysql-field-data/#findComment-1014924 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.