DB $query->result_array() loop issues - 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: DB $query->result_array() loop issues (/showthread.php?tid=2328) |
DB $query->result_array() loop issues - El Forum - 07-30-2007 [eluser]zscott[/eluser] Hello, I'm running the following code, it will find the enrollID's but when looping through those it doesn't seem to want to for-next the second query.. any suggestions? Code: case 'user': Is this a bug with result_array() being nested inside a loop? DB $query->result_array() loop issues - El Forum - 09-07-2007 [eluser]sixpack434[/eluser] I got the same problem, did you find a fix? DB $query->result_array() loop issues - El Forum - 09-07-2007 [eluser]mironcho[/eluser] Can you check $enrollCount value before second loop or var_dump $enrollArr array. Probably $enrollCount is 0. DB $query->result_array() loop issues - El Forum - 09-08-2007 [eluser]zscott[/eluser] I actually did find the fix, but only after a few hours of converting the code to standard PHP code to further debug it. Quote: $query2 = $CI->db->query("SELECT * FROM ClassOffering WHERE classID = '".$enrollArr['enrollID'][$x]."'"); should be Quote: $query2 = $CI->db->query("SELECT * FROM ClassOffering WHERE classID = '".$enrollArr['classID'][$x]."'"); I just had the wrong ID from enrollArr in my WHERE clause........... I swear it's always the simplest crap that gets me going. |