How to make a query statement using php

藏色散人
Release: 2023-03-17 13:38:01
Original
1393 people have browsed it

How to use PHP to make a query statement: 1. Create a PHP sample file; 2. Use mysqli_connect to connect to the database; 3. Pass "$q = "SELECT * FROM user WHERE gender = '".$gender ."'";$result = mysqli_query($db,$q);" statement can be used to implement the query.

How to make a query statement using php

The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.

How to use php to make a query statement?

php uses select statements to query data information

  Finding User 

Finding users from mysql database.

Select gender:
Copy after login
  User found 

User found from mysql database.

"; echo "Name:".$row['name']."
"; echo "Age:".$row['age']."
"; echo "Gender:".$row['gender']."
"; echo "Info:".$row['info']."
"; } mysqli_free_result($result); mysqli_close($db); ?>
Copy after login

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to make a query statement using php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!