jblayney
asked on
test if query has no results
Hello,
I am trying to do a simple test, I want to know if I do not have any results from a query
this does not work
$result_check_answers->num _rows == 0
this does not work
!$result_check_answers->nu m_rows
for testing purposed I
echo $result_check_answers->num _rows
and it echoes
0
I also tried this as well
$result_check_answers->num _rows > 0 and tried to test for more than than 0, but that doesn't work either
How do i test for no results, mysql_num_rows used to work great, but mysqli does not seem to have anything similar
I am trying to do a simple test, I want to know if I do not have any results from a query
this does not work
$result_check_answers->num
this does not work
!$result_check_answers->nu
for testing purposed I
echo $result_check_answers->num
and it echoes
0
I also tried this as well
$result_check_answers->num
How do i test for no results, mysql_num_rows used to work great, but mysqli does not seem to have anything similar
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
https://www.experts-exchange.com/articles/11177/PHP-MySQL-Deprecated-as-of-PHP-5-5-0.html
What you're doing looks right to me, but I can't see the rest of the code. Also, beware of PHP loose typing. Zero and FALSE can mean the same thing, sometimes, but not always.