If you are migrating from PHP 5.5 to a newer version of PHP - you might be interested in a MySQL to MySQLi/PDO migration guide - and use the function mysql_result() you might get a notice (in case your error_reporting is set to show deprecated warnings) that this function is deprecate. Since there is no 1:1> 代码:
function mysqli_result($result,$row,$field =0){
//adjust the result pointer to that specific row
$result->date_seek($row);
// Fetch rsult array
$data = $result->fetch_array();
return $data[$field];
}
-----
PDO Tutorial for Mysql Developers
来源:http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers why user pdo?
mysql_* functions are getting old. For a long time now mysql_* has been at odds with other common SQL database programing interface. It doesn't support modern SQL database concepts such as prepared statements,stored procs,transactions etc... connectiong to mysql?
old way: