In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
How to query the data of php mysql? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Php mysql query data method: first create a php mysql connection; then set the SQL statement to read field information from the data table; then use the SQL statement to extract the result set from the database and assign it to the variable "$result"; finally, return the data information.
PHP MySQL reads data
Use MySQLi
In the following example, we read the data of the id, firstname, and lastname columns from the MyGuests table of the myDB database and display them on the page:
Instance (MySQLi-object oriented)
The above code is parsed as follows:
First, we set up the SQL statement to read the id, firstname and lastname fields from the MyGuests data table. We then use the SQL statement to extract the result set from the database and assign it to the replicated variable $result.
The function num_rows () determines the returned data.
If multiple pieces of data are returned, the function fetch_assoc () puts the associative set into an associative array and loops out. While () loops out the result set and outputs three field values: id, firstname, and lastname.
The answer to the question on how to query php mysql data is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel for more related knowledge.
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.