deadlyp99 Posted July 1, 2008 Share Posted July 1, 2008 Hello, well I am working on a project, and I am simply not getting any errors. Though it is not working as it should. I've done my usually debugging things, but have not done anything but make it worse. So here is the condensed code before I tried fixing it. The domains from the database should be listed in the <select><option> feild. Thank you. <html> <head><title>Member Manager</title></head> <body> <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'root'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql'); $dbname = 'DB_User_Manage'; mysql_select_db($dbname); ?> <form name="SelectAccount" method="post"> <select name="S_Member" > <option selected="yes">-------</option> <?php $list_raw = mysql_query("SELECT * FROM `um_members` ORDER BY ASC"); $list = mysql_fetch_array($list_raw); while ($list) { echo '<option selected="no" value="'.$list['name'].'">-'.$list['domain'].'-</option>\n'; } ?> </select> <input type="submit" value="Select" /> </form> </body> <html> Quote Link to comment https://forums.phpfreaks.com/topic/112841-mysql-data-not-showing/ Share on other sites More sharing options...
.josh Posted July 1, 2008 Share Posted July 1, 2008 while ($list = mysql_fetch_array($list_raw)) { Quote Link to comment https://forums.phpfreaks.com/topic/112841-mysql-data-not-showing/#findComment-579572 Share on other sites More sharing options...
deadlyp99 Posted July 1, 2008 Author Share Posted July 1, 2008 Oh, that was what I had originally, I changed it to be more clear. That doesn't work either Quote Link to comment https://forums.phpfreaks.com/topic/112841-mysql-data-not-showing/#findComment-579574 Share on other sites More sharing options...
.josh Posted July 1, 2008 Share Posted July 1, 2008 well then your query is failing. or your connection is failing. add a die(..) after your other mysql_xx calls (not the fetch_array). The fetch_array needs to be the condition inside the loop. Quote Link to comment https://forums.phpfreaks.com/topic/112841-mysql-data-not-showing/#findComment-579575 Share on other sites More sharing options...
deadlyp99 Posted July 1, 2008 Author Share Posted July 1, 2008 $list_raw = mysql_query("SELECT * FROM um_members ORDER BY ASC"); That is the line that is failing on me. I am not sure what is wrong. Thanks for the die tip, I hadn't thought of it. Quote Link to comment https://forums.phpfreaks.com/topic/112841-mysql-data-not-showing/#findComment-579577 Share on other sites More sharing options...
.josh Posted July 1, 2008 Share Posted July 1, 2008 so what's the error? I notice you just have a message in your other die. Do this: $list_raw = mysql_query("SELECT * FROM um_members ORDER BY ASC") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/112841-mysql-data-not-showing/#findComment-579580 Share on other sites More sharing options...
.josh Posted July 1, 2008 Share Posted July 1, 2008 you know what I think I know what the problem is. You have ORDER BY ASC you need to specify what column to order by. ORDER BY um_members ASC Quote Link to comment https://forums.phpfreaks.com/topic/112841-mysql-data-not-showing/#findComment-579581 Share on other sites More sharing options...
deadlyp99 Posted July 1, 2008 Author Share Posted July 1, 2008 Thank you a lot, that did the trick. Oddly enough, when I tried to get the error using mysql_error, it did not show anything. Quote Link to comment https://forums.phpfreaks.com/topic/112841-mysql-data-not-showing/#findComment-579584 Share on other sites More sharing options...
.josh Posted July 1, 2008 Share Posted July 1, 2008 you got error reporting turned on? Quote Link to comment https://forums.phpfreaks.com/topic/112841-mysql-data-not-showing/#findComment-579586 Share on other sites More sharing options...
deadlyp99 Posted July 1, 2008 Author Share Posted July 1, 2008 yeah, I tried a non-working query of another type and it raised an error. I checked if error reporting was on in php.ini, and it is set to on and E_ALL. Quote Link to comment https://forums.phpfreaks.com/topic/112841-mysql-data-not-showing/#findComment-579624 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.