Mysql+php warning
ray_loubayi
Messages postés
11
Statut
Membre
-
Nabla's Messages postés 20731 Statut Contributeur -
Nabla's Messages postés 20731 Statut Contributeur -
Bonjour,
svp j'ai vraiment besoin d'aide sur cet code
voici l'erreur quelle me donne
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\congo\process.php on line 10
Warning: Cannot modify header information-header already sent by(output started at C:\www\congo\process:10) in C:\wamp\www\congo\process.php on line 22
voici le code
<?php
session_name("Mylogin");
session_start();
if($_GET['action']== "login") {
$conn = mysql_connect("localhost","root","");//myql connection
$db = mysql_select_db("C_electricity");
$name = $_POST['user'];
$query = mysql_query("SELECT * FROM users WHERE user='$name'");
if(mysql_num_rows($query) ==1 ) {
$u_query = mysql_query("SELECT * FROM users WHERE user='$name'");
$data = mysql_fetch_array($query);
if ($_POST['pass'] == $data['password']){
session_register("name");
header("Location:reading.php");
exit;
}else{
header("location: index.php?login=failed&cause=".urlencode('Wrong password'));
exit;
}
} else {
header("location: index.php?login=failed&cause=".urlencode('Invalid user'));
exit;
}
}
//in case of a failure
if(session_is_registered("name")== false){
header("location: index.php");
}
?>
j'ai vraiment besoin d'aide svp! merci
svp j'ai vraiment besoin d'aide sur cet code
voici l'erreur quelle me donne
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\congo\process.php on line 10
Warning: Cannot modify header information-header already sent by(output started at C:\www\congo\process:10) in C:\wamp\www\congo\process.php on line 22
voici le code
<?php
session_name("Mylogin");
session_start();
if($_GET['action']== "login") {
$conn = mysql_connect("localhost","root","");//myql connection
$db = mysql_select_db("C_electricity");
$name = $_POST['user'];
$query = mysql_query("SELECT * FROM users WHERE user='$name'");
if(mysql_num_rows($query) ==1 ) {
$u_query = mysql_query("SELECT * FROM users WHERE user='$name'");
$data = mysql_fetch_array($query);
if ($_POST['pass'] == $data['password']){
session_register("name");
header("Location:reading.php");
exit;
}else{
header("location: index.php?login=failed&cause=".urlencode('Wrong password'));
exit;
}
} else {
header("location: index.php?login=failed&cause=".urlencode('Invalid user'));
exit;
}
}
//in case of a failure
if(session_is_registered("name")== false){
header("location: index.php");
}
?>
j'ai vraiment besoin d'aide svp! merci
A voir également:
- Mysql+php warning
- Easy php - Télécharger - Divers Web & Internet
- Mysql community download - Télécharger - Bases de données
- Warning zone telechargement - Accueil - Outils
- Expert php pinterest - Télécharger - Langages
- Symbole warning word - Forum Word