noqqe


blog | sammelsurium | projects | about

PHP MySQL

2012-01-21 @ Databases, MySQL

Performance-wise it doesn’t matter what you use. The difference is that mysql_fetch_object returns object:

while ($row = mysql_fetch_object($result)) {
    echo $row->user_id;
    echo $row->fullname;
}

mysql_fetch_assoc() returns associative array:

while ($row = mysql_fetch_assoc($result)) {
    echo $row["userid"];
    echo $row["fullname"];
}

and mysql_fetch_array() returns array:

while ($row = mysql_fetch_array($result)) {
    echo $row[0];
    echo $row[1] ;
}