PHP: Catch empty MySQL result
Question by Guest | 2012-11-22 at 17:20
In one of my PHP scripts, it may happen that the result of a MySQL query is empty.
Silly, if then the script just keeps running. Therefore, I would like to know - before outputting the data - if my MySQL result delivers an empty set or data is available. How can I implement it?
Related Topics
PHP: Remove all empty elements from string array
Tip | 0 Comments
MySQL: CSV Export as automatic Download
Tutorial | 0 Comments
HTML5 Validator: How to fix "Warning trimming empty <p> or <div>"
Question | 1 Answer
MySQL: Change minimum word length for full text search
Tip | 1 Comment
jQuery: Submit complete form and receive content with Ajax
Tutorial | 0 Comments
JavaScript: Catch Submit of Form
Tutorial | 0 Comments
MySQL/PHP: How to retrieve the last INSERT ID
Info | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
You can simply use the function mysqli_num_rows(). This function returns the number of records (rows) containing your result:
In this way, you can design your code, to show the user, if there were no hits.
Last update on 2020-09-15 | Created on 2012-11-24