Variable non initialiser
greg3487
Messages postés
17
Statut
Membre
-
greg3487 Messages postés 17 Statut Membre -
greg3487 Messages postés 17 Statut Membre -
bonjours a tous, je début en programmation et j'ai un problème de variable qui ne s'initialise pas.
voici mon code
sa me sort les erreur suivant
Notice: Undefined variable: resultat in C:\WampServer\www\devoirEMWEB\recherche_pays\login2.php on line 66
Fatal error: Call to a member function free() on a non-object in C:\WampServer\www\devoirEMWEB\recherche_pays\login2.php on line 66
merci pour votre aide
voici mon code
<?php
$mysqli = new mysqli('localhost', 'root', '', 'searchs_pays');
if(isset($_POST['submit_form'])) {
$user_input_login = $_POST['user_input_login'];
$user_input_password = $_POST['user_input_password'];
if(empty($user_input_login) OR empty($user_input_password)) {
$message = '<p class="error">Vous devez saisir les informations demandées.</p>';
} else {
$result = $mysqli->query('SELECT user_login, user_password
FROM user WHERE user_login = "'.$user_input_login.'"');
$row = $result->fetch_array();
if(!isset($row['user_login'])) {
$message = '<p class="error">Erreur d\'identification.<br>Vous n\'avez pas accès à cette page</p>';
} else {
$user_login = $row['user_login'];
$user_password = $row['user_password'];
if (crypt($user_input_password, $user_password) != $user_password) {
$message = '<p class="error">Erreur d\'identification.<br>
Vous n\'avez pas accès à cette page</p>';
} else {
session_start();
$_SESSION['user_login'] = $user_login; //EMWEB
header('location:login2.php');
}
}
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Identification</title>
</head>
<body>
<?php
if (isset ($row['user_login'])) {
echo ($_row ['user_login']);
}
if(isset($erreur)) echo "<h2>".$erreur."</h2>";?>
<div id="connexion">
<h1>login</h1>
<form id="log" name="login" method="POST" action="login2.php">
<p>
<label>login :
<input type="text" name="user_input_login" />
</label>
</p>
<p>
<label>Code :
<input type="password" name="user_input_password" />
</label>
</p>
<p>
<label>
<input type="submit" name="bouton" value="Envoyer" />
</label>
</p>
</form>
<?php
$resultat->free();
$mysqli->close();
?>
</div>
</body>
</html>
sa me sort les erreur suivant
Notice: Undefined variable: resultat in C:\WampServer\www\devoirEMWEB\recherche_pays\login2.php on line 66
Fatal error: Call to a member function free() on a non-object in C:\WampServer\www\devoirEMWEB\recherche_pays\login2.php on line 66
merci pour votre aide
A voir également:
- Variable non initialiser
- Impossible d'initialiser le dispositif d'affichage lol - Forum jeux en ligne
- Vba excel sélectionner une plage de cellules variable ✓ - Forum VB / VBA
- Variable objet ou variable de bloc with non définie - Forum VB / VBA
- Variable d'environnement temp - Forum Word
- Variable objet ou bloc "with" non définie - Forum VB / VBA