Message erreur en php/mysql
alex75
-
griese Messages postés 139 Date d'inscription Statut Membre Dernière intervention -
griese Messages postés 139 Date d'inscription Statut Membre Dernière intervention -
Bonjour tout le monde,
voici le fichier "auth.php":
<html>
<head></head>
<body>
<form ACTION='identification.php' method=POST>
<table align=center>
<TR><TD>
Login :
</td>
<td><SELECT NAME='login'>
<OPTION VALUE=1>choisissez votre login
<OPTION VALUE=2>prenom1 nom1
<OPTION VALUE=3>prenom2 nom2
<OPTION VALUE=4>prenom3 nom3
<OPTION VALUE=5>prenom4 nom4
</SELECT>
</td></tr>
<tr><td nowrap>Mot de passe : </td>
<td><input TYPE=password size=20 name='mdp' ></td></tr>
<TR><TD></td><td><input type=submit value='Valider'></TD></TR>
</table>
</form>
</body>
</html>
et puis le fichier "identification.php":
<html>
<head></head>
<body>
<?php
define ('NOM',"root");
define ('PWD',"");
define ('SERVEUR',"localhost");
define ('BASE',"gestano");
$connexion = mysql_pconnect(SERVEUR, NOM, PWD);
if (!$connexion)
{
echo "Désolé, connecxion à ".SERVEUR."impossible";
exit;
}
$bdd = mysql_select_db (BASE, $connexion);
if (!$bdd)
{
echo "Désolé, accès à la base ".BASE." impossible";
exit;
}
$login = $_POST['login'];
$mdp = $_POST['mdp'];
$requete ="select * from user where login = $login and pwd = $mdp";
if(!$val=mysql_fetch_object(mysql_query($requete)))
echo "<font color=red><center><B>Identifiant incorrecte !</B></center></font><br>";
else
$requete ="select groupe from user where login = $login";
if ($user=mysql_fetch_object(mysql_query($requete)))
{
if($user->groupe=="testeur")
// Redirection
Header("Location: menutesteur.php");
if ($user->groupe=="qualification")
// Redirection
Header("Location: menuqualif.php");
if($user->groupe=="developpeur")
// Redirection
Header("Location: menudev.php");
if($user->groupe=="chef de projet")
// Redirection
Header("Location: menuchef.php");
}
mysql_close();
?>
</body>
</html>
le souci est là que à chaque fois j'ai le message erreur
"Warning: mysql_fetch_object(): supplied argument is not a valid MySQL"
savez-vous pour quoi??
Merci beaucoup pour votre aide
voici le fichier "auth.php":
<html>
<head></head>
<body>
<form ACTION='identification.php' method=POST>
<table align=center>
<TR><TD>
Login :
</td>
<td><SELECT NAME='login'>
<OPTION VALUE=1>choisissez votre login
<OPTION VALUE=2>prenom1 nom1
<OPTION VALUE=3>prenom2 nom2
<OPTION VALUE=4>prenom3 nom3
<OPTION VALUE=5>prenom4 nom4
</SELECT>
</td></tr>
<tr><td nowrap>Mot de passe : </td>
<td><input TYPE=password size=20 name='mdp' ></td></tr>
<TR><TD></td><td><input type=submit value='Valider'></TD></TR>
</table>
</form>
</body>
</html>
et puis le fichier "identification.php":
<html>
<head></head>
<body>
<?php
define ('NOM',"root");
define ('PWD',"");
define ('SERVEUR',"localhost");
define ('BASE',"gestano");
$connexion = mysql_pconnect(SERVEUR, NOM, PWD);
if (!$connexion)
{
echo "Désolé, connecxion à ".SERVEUR."impossible";
exit;
}
$bdd = mysql_select_db (BASE, $connexion);
if (!$bdd)
{
echo "Désolé, accès à la base ".BASE." impossible";
exit;
}
$login = $_POST['login'];
$mdp = $_POST['mdp'];
$requete ="select * from user where login = $login and pwd = $mdp";
if(!$val=mysql_fetch_object(mysql_query($requete)))
echo "<font color=red><center><B>Identifiant incorrecte !</B></center></font><br>";
else
$requete ="select groupe from user where login = $login";
if ($user=mysql_fetch_object(mysql_query($requete)))
{
if($user->groupe=="testeur")
// Redirection
Header("Location: menutesteur.php");
if ($user->groupe=="qualification")
// Redirection
Header("Location: menuqualif.php");
if($user->groupe=="developpeur")
// Redirection
Header("Location: menudev.php");
if($user->groupe=="chef de projet")
// Redirection
Header("Location: menuchef.php");
}
mysql_close();
?>
</body>
</html>
le souci est là que à chaque fois j'ai le message erreur
"Warning: mysql_fetch_object(): supplied argument is not a valid MySQL"
savez-vous pour quoi??
Merci beaucoup pour votre aide
A voir également:
- Message erreur en php/mysql
- Recuperer message whatsapp supprimé - Guide
- Message absence thunderbird - Guide
- Message supprimé whatsapp - Guide
- Epingler un message whatsapp - Accueil - Messagerie instantanée
- Message du pere noel gratuit whatsapp - Accueil - Messagerie instantanée
1 réponse
Salut,
change ça déjà,
Je sais pas si marchera après ça mais ça sera déjà mieux.
change ça déjà,
<SELECT NAME='login'> <OPTION VALUE=1>choisissez votre login <OPTION VALUE=2>prenom1 nom1 </OPTION> <OPTION VALUE=3>prenom2 nom2 </OPTION> <OPTION VALUE=4>prenom3 nom3 </OPTION> <OPTION VALUE=5>prenom4 nom4 </OPTION> </SELECT>ensuite, dans ta requète tu oublie de mettre des cotes :
$requete ="select * from user where login = '".$login."' and pwd = $'".mdp."'";
Je sais pas si marchera après ça mais ça sera déjà mieux.