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 Link to comment https://forums.phpfreaks.com/topic/168654-solved-if-contents-are-not-displaying/ 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|? Link to comment https://forums.phpfreaks.com/topic/168654-solved-if-contents-are-not-displaying/#findComment-889713 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). Link to comment https://forums.phpfreaks.com/topic/168654-solved-if-contents-are-not-displaying/#findComment-889717 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. Link to comment https://forums.phpfreaks.com/topic/168654-solved-if-contents-are-not-displaying/#findComment-889723 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.