I need to return true or false rather than 1 & 0, using following query:
true
false
1
0
select if(u.id is null,false
MySQL has no boolean datatype, so you need to stick with 0 and 1 on the MySQL side:
select if(u.id is null, 0, 1) status_int from user u limit 10
If you prefer a boolean over 0/1 in PHP, you can cast it like this:
$status = (bool) $status_int;