Page 1 of 1

MySQL internal row pointer.

Posted: Thu Jul 17, 2008 5:58 pm
by JellyFish
I have a situation where I need to get the index of the internal row pointer in a loop.

Code: Select all

 
while ($row = mysql_fetch_array($result))
{
if (mysql_get_row_pointer() == 0)
{
 
}
}
 
I'm looking for a function like mysql_get_row_pointer(fake function) that should return the index number of the internal row pointer. This way I could do something on the first iteration of the loop.

I tried looking for a mysql function like the above but no luck. :(

I'm sure someone has come across this type of problem?

Re: MySQL internal row pointer.

Posted: Thu Jul 17, 2008 6:04 pm
by Benjamin

Code: Select all

 
$x = 0;
 
while ($row = mysql_fetch_array($result))
{
    if ($x == 0) { /* do something */ }
    $x++'
}
 
 
?

Re: MySQL internal row pointer.

Posted: Thu Jul 17, 2008 6:47 pm
by JellyFish
Oh right. Now I feel a bit dumb. I could use a for loop instead of a while loop.

But I guess why I was posting this is because I was looking for a function that returns the internal row pointer or something.

Anyway, thanks a bunch!