In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces php how to specify conditions to query the database, the article is very detailed, has a certain reference value, interested friends must read it!
Php specifies the conditions to query the database: 1, create a user table in the database; 2, use mysqli_select_db to select the database to operate; 3, specify query conditions through where; 4, use the mysqli_fetch_assoc function to convert the result set data into an array.
This article operating environment: windows7 system, PHP7.1 version, Dell G3 computer.
In the mysql database, create a user table and insert multiple pieces of data into the table for testing.
Create a test.php file within which you use the header () method to set the encoding format of the page to utf-8.
Within the test.php file, connect to the mysql database and use mysqli_select_db to select the database you want to operate on.
Within the test.php file, create a sql statement to get the data from the user data table, and specify the query criteria through where, for example, data with an id of 3, and then use the mysqli_query function to execute the sql statement.
Within the test.php file, use the mysqli_fetch_assoc function to convert the result set data into an array, and use the print_r output to get the data.
Open the test.php file in a browser and view the results.
The above is all the contents of the article "how to specify the conditional query database by php". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.