Joseph Fung
Global Moderator
YaBB God
    
Posts: 4512

Keep smiling: it makes others nervous.
|
 |
Re:requirments wrong at download page
« Reply #6 on: April 19, 2002, 01:02:16 PM » |
|
instead of replacing it with mysql_fetch_row, use mysql_fetch_array
here's a quick explanation of the differences.
Say you are grabbing the fields Name, Email, PhoneNumber, ICQ and FavPositionInBed from a database.
When you get a record, it's in an array - if you use mysql_fetch_row, the array is as follows:
$resultArray = array (0 => value of Name, 1 => value of Email, 2 => value of PhoneNumber, 3 => value of ICQ, 4 => value of FavPositionInBed);
whereas if you use mysql_fetch_assoc the array will be
$resultArray = array ('Name' => value of Name, 'Email' => value of Email, 'PhoneNumber' => value of PhoneNumber, 'ICQ' => value of ICQ, 'FavPositionInBed' => value of FavPositionInBed);
and finally, if you use mysql_fetch_array you'll get
$resultArray = array (0 => value of Name, 1 => value of Email, 2 => value of PhoneNumber, 3 => value of ICQ, 4 => value of FavPositionInBed, 'Name' => value of Name, 'Email' => value of Email, 'PhoneNumber' => value of PhoneNumber, 'ICQ' => value of ICQ, 'FavPositionInBed' => value of FavPositionInBed);
So the benefit of using fetch_row or fetch_assoc is that you have fewer indices.
|