Sir, I am using these codes
<?php
if(isset($_POST['login'])){
require_once("connect.php");
session_start();
// username and password sent from Form
$myusername=addslashes($_POST['username']);
$mypassword=addslashes($_POST['password']);
if(empty($myusername) || empty($mypassword))
{
echo '<script>alert("User name and password must not be empty")</script>';
}else{
$query="SELECT name FROM admin WHERE mobile='".$myusername."' and password='".$mypassword. "'";
$result=mysql_query($query);
if(!$result)
{
echo "<script>alert('username, password query is not working well')</script>" ;
}else{
echo "<script>alert('username, password query is working well')</script>" ;
}
$row=mysql_fetch_array($result);
$count=mysql_num_rows($row);
if($count==1)
{
session_register("myusername");
$_SESSION['myusername']=$myusername;
header("location: welcome.php");
}else {
$error="Your Login Name or Password is invalid";
}
}
}
?>
It is showing these two error messages as
( ! ) Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\Phonebook\login.php on line 22
( ! ) Warning: mysql_num_rows() expects parameter 1 to be resource, null given in C:\wamp\www\Phonebook\login.php on line 23
Line=22
$row=mysql_fetch_array($result);
Line=23
$count=mysql_num_rows($row);
Please help me to locate what I am doing wrong?