Warning: PDOStatement::execute(): SQLSTATE[42000]:
neoh01
Messages postés
1
Date d'inscription
Statut
Membre
Dernière intervention
-
jordane45 Messages postés 38486 Date d'inscription Statut Modérateur Dernière intervention -
jordane45 Messages postés 38486 Date d'inscription Statut Modérateur Dernière intervention -
Bonjour,
j-ai un erreur dans mon code ,ais je n'arrive pas a la trouver:
voici l'erreur:
Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 'fmelo@yopmail.com' OR usr_email = 'fmelo@yopmail.com' LIMIT 1' at line 1 in C:\xampp\htdocs\KMS\W\Model\UsersModel.php on line 41
et voici mon code:
public function getUserByUsernameOrEmail($usernameOrEmail)
{
$app = getApp();
$sql = 'SELECT * FROM ' . $this->table .
' WHERE ' . $app->getConfig('security_username_property') . ' = :username' .
' OR ' . $app->getConfig('security_email_property') . ' = :email LIMIT 1';
$dbh = ConnectionModel::getDbh();
$sth = $dbh->prepare($sql);
$sth->bindValue(':username', $usernameOrEmail);
$sth->bindValue(':email', $usernameOrEmail);
if($sth->execute()){ // line41
$foundUser = $sth->fetch();
if($foundUser){
return $foundUser;
}
}
return false;
}
j-ai un erreur dans mon code ,ais je n'arrive pas a la trouver:
voici l'erreur:
Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 'fmelo@yopmail.com' OR usr_email = 'fmelo@yopmail.com' LIMIT 1' at line 1 in C:\xampp\htdocs\KMS\W\Model\UsersModel.php on line 41
et voici mon code:
public function getUserByUsernameOrEmail($usernameOrEmail)
{
$app = getApp();
$sql = 'SELECT * FROM ' . $this->table .
' WHERE ' . $app->getConfig('security_username_property') . ' = :username' .
' OR ' . $app->getConfig('security_email_property') . ' = :email LIMIT 1';
$dbh = ConnectionModel::getDbh();
$sth = $dbh->prepare($sql);
$sth->bindValue(':username', $usernameOrEmail);
$sth->bindValue(':email', $usernameOrEmail);
if($sth->execute()){ // line41
$foundUser = $sth->fetch();
if($foundUser){
return $foundUser;
}
}
return false;
}
A voir également:
- Warning: PDOStatement::execute(): SQLSTATE[42000]:
- Warning zone telechargement - Accueil - Outils
- Téléchargement et streaming illégal : voici les adresses des sites pirates que les FAI vont bloquer - Accueil - Services en ligne
- Cpu fan fail warning control - Forum Matériel & Système
- Symbole warning word ✓ - Forum Word
- Comment faire le symbole attention ✓ - Forum Loisirs / Divertissements