Skip to content
Advertisement

How to check fetched result set is empty or not?

For example:

JavaScript

AND

JavaScript

How to check if result set is empty or not

Advertisement

Answer

Check $data variable like:

JavaScript

If the result of SELECT query did return any data, variable $data will contain a non-empty array/object which evaluates to true, and a false-like value otherwise.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement