Hello, I am just wondering is it a problem to use mysql_fetch array when i know that I'm going to be pulling out just one row?
mysql_fetch_row gives back an indexed array which isn't sexy.
is there another function I should learn or is mysql_ fetch_array the way to go when just wanting one row as an associative array?
does mysql_ fetch_array have a single friend?
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_assoc($result);
echo '<pre>';
print_r($row);would that be the same as
?
ofcourse if it is, your way is a little less typing, I was just asking because I want to learn the right way of doing things.
Code: Select all
mysql_fetch_array($result1, MYSQL_ASSOC)ofcourse if it is, your way is a little less typing, I was just asking because I want to learn the right way of doing things.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia