mysql_result()

It returns the value of a field in a recordset

MySQL Table – Users
+—-+——+
| id | name |
+—-+——+
|  1 | PHP  |
|  2 | ASP  |
|  3 | JSP  |
|  4 | JS  |
|  5 | AS  |
+—-+——+

Example

<?php
mysql_pconnect(“localhost”, “root”, “phpcode”) or die(mysql_error());
$db_selected = mysql_select_db(“database_name”);
echo mysql_result(mysql_query( “SELECT * FROM users”),1);
mysql_close();
?>

Output

2

Share