Eğer mysql_fetch_assoc() kullandığınızda, temelde satır alınıyor ve daha sonra iç sonuç göstericisi +1 ilerlemektedir.
Daha iyi açıklamak için, burada kodu:
$allUsersResult = mysql_query("SELECT * FROM users");
//Result is into $allUsersResult... Pointer at 0
$user = mysql_fetch_assoc($allUsersResult);
// $user now holds first row (0), advancing pointer to 1
// Here, it will fetch second row as pointer is at 1...
while($users = mysql_fetch_assoc($allUsersResult)){
// the first row is not available here
}
Eğer, yine ilk satır getirme sen do not need sorguyu yeniden çalıştırmak istiyorsanız ilk satırı okudum kez, sadece 0'a geri resetle ...
$allUsersResult = mysql_query("SELECT * FROM users");
//Result is into $allUsersResult... Pointer at 0
$user = mysql_fetch_assoc($allUsersResult);
// $user now holds first row (0), advancing pointer to 1
// Resetting pointer to 0
mysql_data_seek($allUsersResult, 0);
// Here, it will fetch all rows starting with the first one
while($users = mysql_fetch_assoc($allUsersResult)){
// And the first row IS available
}
PHP Documentation: mysql_data_seek() a>