I would like to optimize the script a little and save cpu some work, so I have to create for loop. In this loop I will work with some data from database and below is my current code:
$result = $this->Model->function();
for ($i = 0; $i < $result->num_rows(); $i++)
{
echo $result->row_array($i)['row'];
}
What do I need here is to check if the next row exists. This one would be on the top of all code in for loop in if statement, but there is some problem. If I type $result->num_rows()+1 in for loop and echo the last row (which doesn't exist) out, the value of it isn't null, but it's same as row before.
How do I check if current row is null?