I can't seem to get this to connect to the database so that I can run my prepared statement. Does anybody have an idea what I've forgotten?
private function check_credentials($plain_username, $password)
{
global $dbcon;
$ac = new ac();
$ac->dbconnect();
$userid = $dbcon->prepare('SELECT id FROM users WHERE username = :username AND password = :password LIMIT 1');
$userid->bindParam(':username', $plain_username);
$userid->bindParam(':password', $password);
$userid->execute();
$id = $userid->fetch();
Return $id;
}
EDIT: I changed the SQL query from a SELECT FROM query, to an INSERT INTO query and it worked. WHat the heck is going on?