Home >Backend Development >PHP Problem >How to output mysql query results in php
How to output mysql query results in php: First use navicat to create a new database and create a new table table2; then add new data in table2, and use the [mysql_connect] function to establish a connection with the database on the page; then select the Query the database; finally the php file is checked in the browser.
(Recommendation: php programming(video))
php method to output mysql query results:
1. Use navicat to create a new database database1.
(Recommendation: mysql video tutorial)
2. Create a new table table2 in the database1 database .
#3. Add new data to table2 and create a new database named mysql_query.
#4. Use the mysql_connect function to establish a connection with the database on the page.
5. Use the mysql_select_db function to select the database to be queried.
#6. Add a query statement "$sql=select * from table2" to query the table2 table.
#7. Add the query statement $sql to the query database function mysql_query, and assign the return value to the variable query.
8. Finally, add mysql_query. Open the php file in the browser and view the results of querying the content in the database.
(Related recommendations:Programming video course)
The above is the detailed content of How to output mysql query results in php. For more information, please follow other related articles on the PHP Chinese website!