Jump to content

[SOLVED] list shows incorrect numer of records


Peterson

Recommended Posts

Hello. Thanx for look. This is for me unbelievable...

 

I want display all names beginning with letter "A"

(There is 9 names beginning with A in my database)

 

- when I run SQL query on server, it show proper list of names - 9

SELECT name FROM database WHERE name LIKE 'A%'

 

- when I check mysql_fetch_row() from my php code, if shows real number - 9

 

BUT!!!

when I run this code, it shows only 8 names and does not show the first one.

 

$result = mysql_query("SELECT name FROM database WHERE name LIKE 'A%' ");
$row = mysql_fetch_row($result);

echo mysql_num_rows($result)."<br>";
// Shows number 9

WHILE ($row = mysql_fetch_row($result))
{
echo $row[0]."<br>";
}
// List only 8 names and does not list the first one

 

Please, what's wrong? I found this simple code recommended in all examples on the internet...

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.