Home >Backend Development >PHP Problem >How to query data in mysql database using php
How to use php to query the data in the mysql database
Open the php editor sublime and create a new file. Write notes.
Create a new function chaxun
Connect to the database, fill in the database user name, password, host name and to use database.
Fill in the sql statement of the query.
select * from test1
To read the queried data, the function we use here is fetch_assoc.
Call this function.
Open the local server and enter the URL for access testing. The results are as shown in the figure.
For more PHP knowledge, please visit PHP Tutorial!
The above is the detailed content of How to query data in mysql database using php. For more information, please follow other related articles on the PHP Chinese website!