Reputation: 8116
Is there any function or way of telling if the row you are on is the first in the query result from a mysql_fetch_array()
?
I know how to do this with setting a switch variable, but I was just wondering if there is a more streamlined way to do this.
Thanks.
Upvotes: 4
Views: 1112
Reputation: 14492
You could use mysqli_field_tell() to get the internal pointer of your result set (but only with mysqli* functions).
Upvotes: 0
Reputation: 19237
$i = 0;
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
if (!$i) {
echo "1st row";
}
$i++;
}
Upvotes: 0