I'm using plain PHP with PDO for dealing with MySQL database, I'm developing a login system and when I try to verify matching database record this is my code:
$query = "SELECT id FROM users WHERE username=`:u` AND password=`:p`;";
try{
$q = $db->prepare($query);
$q->bindParam(':u', $this->_username, PDO::PARAM_INT);
$q->bindParam(':p', $this->_passmd5, PDO::PARAM_INT);
if($q->execute()&& ($q->rowCount() == 1)){
return true;
}else{
return false;
}
}catch(PDOException $e){
$this->_errors[] = $e->getMessage();
}
when I submit the user name and password i.e. (admin/password). it gives me that error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column ''admin'' in 'where clause'