In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to judge whether there is data in php mysql". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to judge whether there is data in php mysql".
Php mysql to determine whether there is data: 1, to create a PHP example file; 2, to get the number of rows of select result set; 3, to return the number of rows affected by the last operation; 4, through the sql query function code to determine whether there is data.
This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer
How can php mysql tell if there is any data? How does php determine whether the query result of the SQL statement is empty?
PHP and mysql work well together, but occasionally encounter small requirements that don't know what to do, such as what we're going to talk about today: how to determine whether the result set of a sql query is empty!
Let's take querying student information as an example to see how to meet our needs.
First, let's take a look at what the data stored in our datasheet "student" looks like.
Id stuname gender age grade class1 Zhang San male 16 17 32 Li Si male 15 18 23 Wang Beautiful female 16 17 5
Let's take a look at the sql query function code. We need to find out the information of the students who are 16 years old.
Gender: age: grade: class:
The above is the query function. When the result set is not empty, everything is fine. When the dataset is empty, you will get a blank ul tag.
As users do not know why they did not get the data, at this time we need to give the user a prompt message, then we need to determine whether the result set is empty!
There are two ways to determine whether the result set is empty:
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.