Jump to content

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/161363-solved-echo-is-blank/
Share on other sites

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);

Link to comment
https://forums.phpfreaks.com/topic/161363-solved-echo-is-blank/#findComment-851517
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.