note 13659 deleted from ref.mysql by irc-html
| From: | irc-html@php.net | Date: | Wed, 02 Jan 2002 06:43:30 +0000 |
| Subject: | note 13659 deleted from ref.mysql by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-24191@lists.php.net to get a copy of this message | ||
Ok, I'm new at this, and I imagine a lot of people who would actually care to try out the
example above are new at it as well. For those of you who do try this example, if you run it, you
will get duplicate data. In other words if you had a database called "phone" that had
name and phone numbers in each row. You run the script in this example against that database
it's going to return
Jack Jack 555-555-1212 555-555-1212
Jill Jill 555-555-1212 555-555-1212
I for one can't imagine why you'd want to do that. I do know that if you change the
following line:
while($line = mysql_fetch_array($result)){
to:
while($line = mysql_fetch_ROW($result)){
Then this problem goes away, and you now get:
Jack 555-555-1212
Jill 555-555-1212
It's something to with the difference between mysql_fetch_array and mysql_fetch row. I
don't understand what the difference is, but I know that it frustrated me for 4 hours before
figuring it out, so I thought I'd share it with any other newbies that may be beating their
heads on their desks over this one.