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.
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
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); ?>
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!