I have the following warning only when paword is wrong
Warning : mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\mijn_stamboom\login\login.php on line 23
<?php
include_once '../common.php';
include("config.php");
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$myusername1=addslashes($_POST['username']);
$mypassword1=addslashes($_POST['password']);
$ip = $_SERVER["REMOTE_ADDR"];
$pass1 = md5($mypassword1);
$sql1="SELECT * FROM stamboom_admin WHERE username='$myusername1' and password='$pass1' and ipadres='$ip'";
$result1=mysql_query($sql1);
$row1=mysql_fetch_array($result1); // this is line 23
if ($row1['id'] != '1' && $row1['ip_adres'] == '127.0.0.1'){
$active1=$row1['active'];
$count1=mysql_num_rows($result1);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count1==1)
{
session_register("username");
$_SESSION['login_user']=$myusername1;
header("location: welcome_user.php");
}
else
{
$error="<font color='green'>Uw login naam of wactwoord is fout.</font>";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $lang['PAGE_TITLE']; ?></title>
</head>
<body>
<center><div style="margin-top:100px;">
<div style="width:350px; border: solid 1px #333333; " align="left">
<div style="background-color:#333333; color:#FFFFFF; padding:3px;"><b>Login</b></div>
<div style="margin:30px">
<form action="" method="post">
<label style="margin-left:10px; background-color:#333333; color:#FFFFFF; padding:3px;">UserName :</label><input type="text" name="username" class="box"/><br /><br />
<label style="margin-left:10px; background-color:#333333; color:#FFFFFF; padding:3px;">Password :</label><input type="password" name="password" class="box" /><br/><br />
<center><input type="submit" value=" Submit" name="loggedin"/></center><br />
</form>
</div>
</div>
</div></center>
</body>
</html>
<?php
die();
}
}
else
{
bla bla bla
<?php
die();
}
}}
?>
Thanks in advice John Dohmen