[SOLVED] Â Checking result set from DB::Query |
10/5/2019 10:51:42 PM |
PHPRunner General questions | |
J
jacktonghk authorDevClub member
I am a newbie to PHPRunner. I use DB::Query to read a table with a where clause. How can quickly check if the result set is empty before doing a while loop to fetch data? Thanks. |
|
![]() |
Sergey Kornilov admin 10/6/2019 |
While loop will not be executed if there is no data. There is no need to do anything additionally. $rs = DB::Query("select * from carsmake");
|
J
|
jacktonghk authorDevClub member 10/11/2019 |
Since my result set will return only 1 row or none. I use if ($data = $rs->fetchAssoc()) else .... to show a message if nothing is returned. Thank you. |