Arkadaslar basit bir kayit sayfasının login kismini yapmaya calisiyorum ama surekli bu hatayi aliyorum sorunu anlamadim bir yardimci olurmusunuz.Hata;
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\XXXXXX\www\XXX\login.php on line 15
Script;
<?php
@session_start();
include("header.php");
include("functions.php");
connect();
if(isset($_POST ['login'])) {
if(isset($_SESSION['uid'])){
echo "You are logged in";
}else{
$username= protect($_POST['username']);
$password= protect($_POST['password']);
$loggin_check = mysql_query ("SELECT `id` FROM `user` WHERE `username`='$username' AND `password`='".md5($password)."'")or die(mysql_error());
if(mysql_num_rows($login_check) == 0 ) {
echo "Invalid Username/Password Combinations!";
}else{
$get_id =mysql_fetch_assoc($login_check);
$_SESSION['uid']=$get_id['id'];
header ("Location:main.php");
}
}
}else{
echo "You have visited this page incorrectly !";
}
include("footer.php");
?>
Kirmizi satir hata oldugunu söyleidigi satir.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\XXXXXX\www\XXX\login.php on line 15
Script;
<?php
@session_start();
include("header.php");
include("functions.php");
connect();
if(isset($_POST ['login'])) {
if(isset($_SESSION['uid'])){
echo "You are logged in";
}else{
$username= protect($_POST['username']);
$password= protect($_POST['password']);
$loggin_check = mysql_query ("SELECT `id` FROM `user` WHERE `username`='$username' AND `password`='".md5($password)."'")or die(mysql_error());
if(mysql_num_rows($login_check) == 0 ) {
echo "Invalid Username/Password Combinations!";
}else{
$get_id =mysql_fetch_assoc($login_check);
$_SESSION['uid']=$get_id['id'];
header ("Location:main.php");
}
}
}else{
echo "You have visited this page incorrectly !";
}
include("footer.php");
?>
Kirmizi satir hata oldugunu söyleidigi satir.