CI_DB_mysql_result Object causing infinite loop |
[eluser]Unknown[/eluser]
Hey folks, doing a simple Active Record select. It looks a little something like this: Code: $query = $CI->db->select( 'answer' ) $query becomes the expected CI_DB_mysql_result Object with result rows and a current row of 0. Expected. Code: while($row = $query->row() ) This is a commonly used pattern - but this time it triggers an infinite loop. When I output the row, it turns out that $query is dumping the first initial row infinitely many times. It is never iterating. https://github.com/EllisLab/CodeIgniter/issues/2298 seems related but does not lead to a solution. Ideas? Edit: I put this in Libraries because this code is in a custom library class.
[eluser]CroNiX[/eluser]
Code: $query = $CI->db->select( 'answer' ) Code: foreach($query as $row)
[eluser]Unknown[/eluser]
I went with a similar approach, Code: foreach( $query->result() as $row) |
Welcome Guest, Not a member yet? Register Sign In |