I'm encountering a problem with this object. I don't know (if it is possible), how to get the value of COUNT(id)
.
I tried $req[0]->COUNT(id) but "COUNT()"
it detected it as a function. How could it be detect as a key?
Here's a var_dump($req):
object(stdClass)[4]
public 'COUNT(id)' => string '1' (length=1)
PHP
$req = $db->query('SELECT COUNT(id) FROM `users` WHERE username ="'.$username.'" AND password = "'.$password.'"');
if($req == 1){
$_SESSION['authentificated'] = true;
$_SESSION['username'] = $username;
}
var_dump($req);
The output of the query should be 0
or 1
if the user is already register or not.