Welcome Guest, Not a member yet? Register   Sign In
Get next row in mysql results
#1

[eluser]Unknown[/eluser]
I was just wondering if there is a way to get the next row in advanced when looping through a mysql results. At the moment I have

Code:
<? $i=1; ?>
<? foreach ($query->result() as $row): ?>
    
    <?= $row->order_id ?>

<? $i++; ?>
<? endforeach; ?>

At the moment this just echo's the order_id in the row its currently looping through but is there a way to get the order_id of the next row in advance?

The reason I want to do this is because if I know the order_id is going to change on the next row then I will want to echo something different.

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB