Jump to content

[SOLVED] echo is blank


jeff5656

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.