Mysqli -> num_rows always returns 1

后端 未结 1 1900
不思量自难忘°
不思量自难忘° 2021-01-29 02:13

This seems to always return 1 for $item_result->num_rows; even though there are 0 rows in the DB. However, if an item exists it updates the row correctly. I\'m sure something is

相关标签:
1条回答
  • 2021-01-29 03:04

    When you do SELECT COUNT(*) there will always be at least one result. Even if its 0.

    You will need to fetch the result of the query to get the correct count.

    0 讨论(0)
提交回复
热议问题