Home  >  Article  >  Backend Development  >  How to output mysql query results in php

How to output mysql query results in php

coldplay.xixi
coldplay.xixiOriginal
2020-08-15 15:09:116916browse

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.

How to output mysql query results in php

(Recommendation: php programming(video))

php method to output mysql query results:

1. Use navicat to create a new database database1.

How to output mysql query results in php

(Recommendation: mysql video tutorial)

2. Create a new table table2 in the database1 database .

How to output mysql query results in php

#3. Add new data to table2 and create a new database named mysql_query.

How to output mysql query results in php

#4. Use the mysql_connect function to establish a connection with the database on the page.

How to output mysql query results in php

5. Use the mysql_select_db function to select the database to be queried.

How to output mysql query results in php

#6. Add a query statement "$sql=select * from table2" to query the table2 table.

How to output mysql query results in php

#7. Add the query statement $sql to the query database function mysql_query, and assign the return value to the variable query.

How to output mysql query results in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn