jeff5656 Posted June 8, 2009 Share Posted June 8, 2009 When I echo row4['resident'] it is blank. Same with the <option> drop downs which are not populated. When I go into phpmyadmin, the resident field does contain names, so it's not like they are blank. Note: earlier in the code I connect to the database and there are no errors when I run this. <?php $query4 = "SELECT * FROM icu WHERE signoff_status = 'a'"; $results4 = mysql_query ($query4) or die (mysql_error()); ?> <select name = "resident" > <option selected="" value="">--Select</option> <?php while ($row4 = mysql_fetch_assoc ($results4)) { echo $row4['resident'] . "<br>"; ?><option value = "<?php echo $row4['resident'];?>"><?php echo $row4['resident'];?></option> <?php }?> </select> Quote Link to comment https://forums.phpfreaks.com/topic/161363-solved-echo-is-blank/ Share on other sites More sharing options...
Adam Posted June 8, 2009 Share Posted June 8, 2009 Have you tried dumping the data to see what's in there? var_dump($row4); Put that within the while loop and check there's actually data in there. If not it's likely the query's running successfully but not returning any results. You can check the number of records returned with: echo mysql_num_rows($query4); Quote Link to comment https://forums.phpfreaks.com/topic/161363-solved-echo-is-blank/#findComment-851517 Share on other sites More sharing options...
MadTechie Posted June 8, 2009 Share Posted June 8, 2009 I love it when they say thanks! Quote Link to comment https://forums.phpfreaks.com/topic/161363-solved-echo-is-blank/#findComment-851651 Share on other sites More sharing options...
Adam Posted June 8, 2009 Share Posted June 8, 2009 Ha.. makes it all worth while. Quote Link to comment https://forums.phpfreaks.com/topic/161363-solved-echo-is-blank/#findComment-851657 Share on other sites More sharing options...
PFMaBiSmAd Posted June 8, 2009 Share Posted June 8, 2009 Judging by the thread that came after this one, his problem/solution was that there apparently are blank values in the table. [garbage out = garbage in] Quote Link to comment https://forums.phpfreaks.com/topic/161363-solved-echo-is-blank/#findComment-851670 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.