Ik heb hier een check php file voor als iemand zich wilt inloggen op een website.
Code:
<?php
$host="xxxxx";
$username="xxxxx";
$password="xxxxx";
$db_name="xxxxx";
$tbl_name="xxxxx";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$UserID=$_POST['UserID'];
$Paswoord=$_POST['Paswoord'];
$UserID = stripslashes($UserID);
$Paswoord = stripslashes($Paswoord);
$UserID = mysql_real_escape_string($UserID);
$Paswoord = mysql_real_escape_string($Paswoord);
$sql="SELECT * FROM $tbl_name WHERE username ='$UserID' and Paswoord='$Paswoord'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_register("UserID");
session_register("Paswoord");
header("location:login_success.php");
}
else {
echo "Foute duiker of paswoord";
}
?>
$host="xxxxx";
$username="xxxxx";
$password="xxxxx";
$db_name="xxxxx";
$tbl_name="xxxxx";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$UserID=$_POST['UserID'];
$Paswoord=$_POST['Paswoord'];
$UserID = stripslashes($UserID);
$Paswoord = stripslashes($Paswoord);
$UserID = mysql_real_escape_string($UserID);
$Paswoord = mysql_real_escape_string($Paswoord);
$sql="SELECT * FROM $tbl_name WHERE username ='$UserID' and Paswoord='$Paswoord'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_register("UserID");
session_register("Paswoord");
header("location:login_success.php");
}
else {
echo "Foute duiker of paswoord";
}
?>
Nu krijg ik volgende fout:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /customers.../checklogin.php on line 24
Wrong Username or Paswoord
Hoe kan ik dit oplossen?
Alvast bedankt.












Auteur




Gelogd


. De variabele $result is namelijk false, en 