| PHP Database Integration With MySQL |
|
|
|
| The Article - php | |||||||||
| Written by Chetankumar Akarte | |||||||||
| Wednesday, 07 March 2007 | |||||||||
Page 5 of 7 Retrieve data:The mysql_query() function of PHP also allow us to get data from table. The following code gives you an idea about that...
$result = mysql_query( "SELECT * FROM $table"); After perfoming SELECT operation using mysql_query() function, result is stored in the identifier $result. Now with the mysql_num_rows() function, we get the total number of rows of table ‘visitor’. Now, to display data of table, we use the PHP function mysql_fetch_row() which gives us all data of the table. mysql_fetch_row() returns false when it finds end-of-data in the table. We use it with the while condition to display the content of table ‘visitor’. Following code displays table content (Code-5).
Code 5: printdata.php ![]() PHP MySQL Database Integration |
|||||||||
| Last Updated ( Tuesday, 13 March 2007 ) | |||||||||