This the same post
Hi I don't know what to say an d what to do.
After solving a problem another one show up.
What's wrong with the code.
$sql = "select pseudo,passe, id from membre where pseudo='$pseudo_membre' and passe = '$passe_membre' and id = '$id'";
$result = mysql_query($sql) or die('query failed. ' . mysql_error());
$num_rows = mysql_num_rows($result);
//echo "$num_rows";
//$requete=mysql_query($sql_bdd,"select pseudo,passe from membre where pseudo=\"$pseudo_membre\" and passe=\"$passe_membre\"",$db_link) or die(mysql_error());
//$num_rows = mysql_num_rows($result);
//echo $num_rows;
// SI AUCUN ENREGISTREMENT NE CORRESPOND
if($num_rows > 0){
// SI LE LOGIN ET MOT DE PASSE SONT EXACTES
// CREATION D'UN IDENTIFIANT ALEATOIRE
$taille = 20;
$lettres = "abcdefghijklmnopqrstuvwxyz0123456789";
srand(time());
for ($i=0;$i<$taille;$i++)
{
$id.=substr($lettres,(rand()%(strlen($lettres))),1);
}
// MISE A JOUR DE L'IDENTIFIANT DANS LA TABLE
$query = "UPDATE membre
SET id = '$id'
WHERE pseudo = '$pseudo_membre' and passe='$passe_membre'";
mysql_query($query) or die('Error, modifying table membre failed : ' . mysql_error());
//$requete=mysql_query($sql_bdd,"update membre set id=\"$id\" where pseudo=\"$pseudo_membre\" and passe=\"$passe_membre\"",$db_link) or die(mysql_error());
// REDIRECTION VERS UNE PAGE PROTEGEE AVEC L'IDENTIFIANT SERVANT DE CLE
header("Location:zonemembre.php3?id=$id");
//header("location:$zone_membre");
}
else if($num_rows ==0){ echo "what is it?";
// REDIRECTION VERS LA PAGE ERREUR
//header("Location:$url_erreur");
//header('location: toi/erreur.htm');
//header('location: login.php3');
}
// DECONNEXION MYSQL
mysql_close($db_link);
when I try to print the row, it's always equal to zero. That means my select doesn't execute.
Please can s.o help me!