![]() |
if statement gone wrong - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: if statement gone wrong (/showthread.php?tid=36155) |
if statement gone wrong - El Forum - 11-23-2010 [eluser]snowstar[/eluser] Hi all, Im wondering if some one can point me in the right direction, i've written an if statement which should only print out results if one varable matchs the other. How ever its displays all the information in the table snippet from my controller Code: $data = array(); snippet from my View Code: <?php if(isset($drecords)) : foreach($drecords as $drow) : ?> Note: $row->invnum is in a for each loop above this and doesnt close till end of page. Im attempting to only print details that $row->invnum match $drow->orderid, Im not sure where im going wrong The whole page is a template which is repeated for each result (from parent for each) if statement gone wrong - El Forum - 11-23-2010 [eluser]Rob @ iFetch[/eluser] '=' != '==' To elaborate... "The comparison between $my_name and "someguy" was done with a double equal sign "==", not a single equals"="! A single equals is for assigning a value to a variable, while a double equals is for checking if things are equal." from http://www.tizag.com/phpT/if.php if statement gone wrong - El Forum - 11-23-2010 [eluser]dudeami0[/eluser] Code: $data = array(); That would possibly work, else something like: Code: $data = array(); |