I know that in SQL if I wrote
SELECT EXISTS(SELECT 1 FROM userdata WHERE user_id=2);
SQL returned a 1 if it managed to select and a 0 if not.
+------------------------------------------------+
| EXISTS(SELECT 1 FROM userdata WHERE user_id=2) |
+------------------------------------------------+
| 1 |
+------------------------------------------------+
How would I check this in a PHP? I am using MySQLi. I want the code to look something like this…
$selectbruh = SELECT EXISTS(SELECT 1 FROM userdata WHERE user_id=2);
if(select returned 1){
//Do this
}else if(returned 0){
//Do this
}else{
//Explode into smithereens
}