In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to achieve PHP access to MySQL database record data, the article is very detailed, has a certain reference value, interested friends must read it!
Get the total number of records in the data table
You can also get:
Another form: ($row ['total'] can also be changed into $row [0])
Referring to the PHP operation manual, there are too many similar functions, which means that PHP has a lot of ways to deal with the same requirements.
Get the record of the database query table and return it in JSON format
The returned data:
[{"C01": "00924001", "C02": "Manager's Office 01", "C03": "1", "C04": "ordinary users", "C05": "1"}, {"C01": "00924002", "C02": "Manager's Office 02", "C03": "2", "C04": "ordinary users", "C05": "1"} {"C01": "00923128", "C02": "personnel Section 01", "C03": "1", "C04": "ordinary users", "C05": "Zhang Xiaoyong of personnel Section"}]
Get the data table paged record data and return it to JSON format (take the paged data of LayUI as an example)
The returned data:
{"code": 0, "msg": "", "count": "12", "data": [{"C01": "00101078", "CO2": "HaoR", "C03": "2", "C04": "administrator", "C05": "1"}, {"C01": "00323007" "C02": "Research Center 01", "C03": "1", "C04": "Administrator", "C05": "1"}, {"C01": "00616001", "C02": "Finance Section 01", "C03": "1", "C04": "Administrator", "C05": "1"} {"C01": "00616002", "C02": "Finance Section 02", "C03": "1", "C04": "Administrator", "C05": "1"}, {"C01": "00616003", "C02": "Finance Section 03", "C03": "1", "C04": "Administrator" "C05": "1"}, {"C01": "00923127", "C02": "admin", "C03": "1", "C04": "administrator", "C05": "system administrator"}, {"C01": "00923128", "C02": "personnel Section 01", "C03": "1" "C04": "ordinary user", "C05": "Zhang Xiaoyong" of personnel Section}, {"C01": "00923129", "CO2": "personnel Section 02", "C03": "1", "C04": "Administrator", "C05": "1"}]}
You can return different data styles according to the paging requirements of the front end, and it will be easy to know the rest of the PHP processing.
The processing of mysql database query result set by PHP.
⑴ fetch_array ()
The result returned row by line:
00924001 Manager's Office 01
00924002 Manager's Office 02
00923128 personnel Section 01
Returns the JSON format:
The three outputs are all the following:
00924001 Manager's Office 01
00924002 Manager's Office 02
00923128 personnel Section 01
⑵ fetch_row ()
The above output can be done using the following methods:
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.