Krentenbol
01-05-2012, 08:02 PM
I have done this atleast a hundred times before, suddenly I just can't anymore-.-.
Code:
<?php
include ('inc/config.php');
mysql_select_db('inlogsysteem', $con) or die;
$gebruikersnaam = $_REQUEST['gebruikersnaam'];
$wachtwoord = sha1($_REQUEST['wachtwoord']);
$result = mysql_query("SELECT wachtwoord FROM gebruikers where gebruikersnaam = '$gebruikersnaam'") or die (mysql_error());
while ($row = mysql_fetch_array($result))
if ($wachtwoord != $row['wachtwoord']) {
echo "Verkeerd wachtwoord";
}
else {
$sql="SELECT * FROM status WHERE gebruikersnaam='$gebruikersnaam'";
$result2=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result2);
echo $count;
// If result matched $ip and $password, table row must be 1 row
if($count==1){
session_register("gebruikersnaam");
echo "Logged in";
}
else
echo "not logged in";
}
?>
My error:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\Login\login.php on line 18
Code:
<?php
include ('inc/config.php');
mysql_select_db('inlogsysteem', $con) or die;
$gebruikersnaam = $_REQUEST['gebruikersnaam'];
$wachtwoord = sha1($_REQUEST['wachtwoord']);
$result = mysql_query("SELECT wachtwoord FROM gebruikers where gebruikersnaam = '$gebruikersnaam'") or die (mysql_error());
while ($row = mysql_fetch_array($result))
if ($wachtwoord != $row['wachtwoord']) {
echo "Verkeerd wachtwoord";
}
else {
$sql="SELECT * FROM status WHERE gebruikersnaam='$gebruikersnaam'";
$result2=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result2);
echo $count;
// If result matched $ip and $password, table row must be 1 row
if($count==1){
session_register("gebruikersnaam");
echo "Logged in";
}
else
echo "not logged in";
}
?>
My error:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\Login\login.php on line 18