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
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|?

Link to comment
Share on other sites

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.

Link to comment
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.