![]() |
Check if table is empty - 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: Check if table is empty (/showthread.php?tid=56464) |
Check if table is empty - El Forum - 12-21-2012 [eluser]Volkof[/eluser] Hi, Can anyone guide me on how to check if a returned table is empty? I used this: Code: <?php but the if(!(empty($row))) does not seems to work. Check if table is empty - El Forum - 12-21-2012 [eluser]Aken[/eluser] Look into num_rows() or count_all() methods. Check if table is empty - El Forum - 12-21-2012 [eluser]Rowan Wilson[/eluser] There are many ways to achieve this. In your if statement in the foreach loop you don't need the parenthesis around empty(). But otherwise, why not check your result is not empty before trying to loop through it? e.g. Code: if($programmes) Check if table is empty - El Forum - 12-21-2012 [eluser]Volkof[/eluser] Thanks rowstu. It works now ![]() |