Welcome Guest, Not a member yet? Register   Sign In
$query->next_row() usability
#1

[eluser]Drew J[/eluser]
Hey guys,

I have a simple example:

Code:
foreach($query->result() as $row):
                
    // Get the next row for reference
    $next_row = $query->next_row();
    // Get the previous row for reference
    $prev_row = $query->previous_row();

endforeach;

My expected result is that on the first iteration through the loop:
- $row would be row #1
- $next_row would be row #2
- $prev_row might be NULL or return row #1
Then the next loop:
- $row would be row #2
- $next_row would be row #3
- $prev_row would be row #1

Instead, I just keep getting the same row for $next_row and $prev_row. Like the pointer isn't changing. $row works as expected of course.

Can anyone shed some light on this?

I've poked through the DB_result library for about 30 minutes trying to find a problem with no luck.


Messages In This Thread
$query->next_row() usability - by El Forum - 04-14-2009, 09:08 PM
$query->next_row() usability - by El Forum - 04-14-2009, 09:16 PM
$query->next_row() usability - by El Forum - 04-15-2009, 10:06 AM
$query->next_row() usability - by El Forum - 04-15-2009, 11:49 AM
$query->next_row() usability - by El Forum - 04-15-2009, 11:58 AM
$query->next_row() usability - by El Forum - 04-15-2009, 12:04 PM
$query->next_row() usability - by El Forum - 04-15-2009, 12:11 PM
$query->next_row() usability - by El Forum - 04-15-2009, 01:25 PM
$query->next_row() usability - by El Forum - 04-18-2009, 05:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB