Jump to content

[SOLVED] if { contents are not displaying


jeff5656

Recommended Posts

The contents in the if are not displaying:

$consultsq3 = "SELECT * FROM icu INNER JOIN bundle ON icu.id_incr = bundle.pt_id AND icu.id_incr = ' " . $row['id_incr'] . " '"; 

$result3 = mysql_query ($consultsq3) or die ("Invalid query: " . mysql_error ());
while ($row3 = mysql_fetch_assoc ($result3)) {
	echo "<br>".$row3['bundle_date'] . "and curr date is" . $current_date;
	if ($row3['bundle_date'] == $current_date) {
		echo "<img src='../consults/images/greencheck2.png' alt='greencheck' width='15' height='20' border='0'/>";
		echo "green check";
	}
}

But the condition is true.  When I echo it out I get:

2009-08-03 and curr date is 2009-08-03

 

Link to comment
https://forums.phpfreaks.com/topic/168654-solved-if-contents-are-not-displaying/
Share on other sites

maybe they look the same in browser but not in source? perhaps there's white space or something.  what do you see if you try:

 

echo "<br>|".$row3['bundle_date'] . "| and curr date is |" . $current_date ."|";

 

is there space between any of the |pipes|?

Ok I am embarrassed to say that $current_date was not defined.  I have NO idea why inititally when I echoed it out it said today's date.  Maybe the $current_date was populated as today's date from another file, although it's nto a session variable so I have no idea how that happened.  Anyway, I went back and did:

 

$current_date = date ("Y-m-d");

 

and all is well.

I like the var_dump advice- I will haee to try that next time I echo out variables.

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.