Home >Backend Development >PHP Problem >How to query data in mysql database using php

How to query data in mysql database using php

藏色散人
藏色散人Original
2019-09-18 10:25:393441browse

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.

How to query data in mysql database using php

Create a new function chaxun

How to query data in mysql database using php

Connect to the database, fill in the database user name, password, host name and to use database.

How to query data in mysql database using php

Fill in the sql statement of the query.

select * from test1

How to query data in mysql database using php

To read the queried data, the function we use here is fetch_assoc.

How to query data in mysql database using php

Call this function.

How to query data in mysql database using php

Open the local server and enter the URL for access testing. The results are as shown in the figure.

How to query data in mysql database using php

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!

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