0

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?

2
Contributors
1
Reply
10
Views
3 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.