PHP mysql_result function
The PHP mysql_result function is used to obtain MySQL result data. It is more suitable for processing where the amount of data is not too large. If the amount of data is large, other functions with better performance such as mysql_fetch_row and mysql_fetch_array should be used. mysql_result has been deprecated in PHP 5.5.0, replaced by mysqli_data_seek combined with mysqli_field_seek and mysqli_fetch_field.
PHP mysql_result function syntax
- resource $result: mysql_query processing result, necessary item.
- int $row-the number of rows to be retrieved (row number), row number starts from 0.
- mixed $field-the offset of the field, the default value is 0, not required.
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$sql = mysql_select_db('database_name');
$result = mysql_query('SELECT name FROM student');
echo mysql_result($result, 2);
?>
Post a Comment
0 Comments