jeff5656 Posted August 3, 2009 Share Posted August 3, 2009 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 Quote Link to comment Share on other sites More sharing options...
micah1701 Posted August 3, 2009 Share Posted August 3, 2009 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|? Quote Link to comment Share on other sites More sharing options...
TeNDoLLA Posted August 3, 2009 Share Posted August 3, 2009 use var_dump($var) instead of echo when debugging. It will give you the exact length of the string and also type (type doesn't matter in this case because you dont use the === operator anyway). Quote Link to comment Share on other sites More sharing options...
jeff5656 Posted August 3, 2009 Author Share Posted August 3, 2009 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. Quote Link to comment 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.