Fatal error: Call to a member function prepare() on a non-object
lovingun
-
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 -
Hello i made a website and i have a problem in Login.php and Register.php !! It's the same.
PROBLEM IS IN THE LINE N°6 : Fatal error: Call to a member function prepare() on a non-object in /home/a7278696/public_html/login.php on line 111
PROBLEM IS IN THE LINE N°6 : Fatal error: Call to a member function prepare() on a non-object in /home/a7278696/public_html/login.php on line 111
{
$errors[] = 'Please fill in all fields';
}
if (empty($errors))
{
$SQLCheckLogin = $odb -> prepare("SELECT COUNT(*) FROM `users` WHERE `username` = :username AND `password` = :password");
$SQLCheckLogin -> execute(array(':username' => $username, ':password' => SHA1($password)));
$countLogin = $SQLCheckLogin -> fetchColumn(0);
if ($countLogin == 1)
{
$SQLGetInfo = $odb -> prepare("SELECT `username`, `ID`, `status` FROM `users` WHERE `username` = :username AND `password` = :password");
$SQLGetInfo -> execute(array(':username' => $username, ':password' => SHA1($password)));
$userInfo = $SQLGetInfo -> fetch(PDO::FETCH_ASSOC);
if ($userInfo['status'] == "0")
{
$_SESSION['username'] = $userInfo['username'];
$_SESSION['ID'] = $userInfo['ID'];
$ip = getRealIpAddr();
$SQL = $odb -> prepare('INSERT INTO `loginlogs` VALUES(:username, :ip, UNIX_TIMESTAMP(), "")');
$SQL -> execute(array(':ip' => $ip, ':username' => $username));
echo '<div class="alert alert-success"><center><p><font color=\'black\'>Login Succeed. Redirecting....</font></p></center></div><meta http-equiv="refresh" content="3;url=index.php">';
die();
}
A voir également:
- Call to a member function prepare() on a non-object
- Fan error lenovo - Forum Refroidissement
- Cmos checksum error ✓ - Forum Carte-mère/mémoire
- Playback error reconnect in 3s (1/5) francais - Forum Box et Streaming vidéo
- Error 1962 ✓ - Forum PC fixe
- Whea error occt - Forum Processeur
3 réponses
Hello,
my guess is that your $odb object has not been properly instantiated...
I can't tell since you are not showing us where it came from.
my guess is that your $odb object has not been properly instantiated...
I can't tell since you are not showing us where it came from.
Bonjour
Montre nous le code de connexion à la bdd.
Active également si ce n'est pas déjà fait la gestion des erreurs pdo
https://forums.commentcamarche.net/forum/affich-37584941-php-pdo-gerer-les-erreurs
Nb:tu es sur un site francophone. .. merci de ne pas y parler en anglais...
.
Montre nous le code de connexion à la bdd.
Active également si ce n'est pas déjà fait la gestion des erreurs pdo
https://forums.commentcamarche.net/forum/affich-37584941-php-pdo-gerer-les-erreurs
Nb:tu es sur un site francophone. .. merci de ne pas y parler en anglais...
.