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> Quote 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); Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.