Click here to Skip to main content
15,897,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
PHP
include("includes/connect.php");
if(isset($_POST['login'])){


$user_name=$_POST['user_name'];
$user_pass=$_POST['user_pass'];

$login_query="select * all from admin_login where user_name='$user_name' and user_password='$user_pass'";

$run=mysql_query($login_query); 

if(mysql_num_rows($run)>=1){ 


$_SESSION['user_name']=$user_name;
echo "<script>window.open('index.php','_self')";
}
else{
echo "<script>alert('user name or password is incorrect')</script>";
}
}
?>
Posted
Updated 17-Dec-15 21:42pm
v2
Comments
CPallini 18-Dec-15 3:44am    
I don't see the mysql_fetch_array call in the posted code.

check you Semtex

$login_query="select * all from admin_login where user_name='.$user_name.' and user_password='.$user_pass.'";

you concat string
 
Share this answer
 
This is your problem $login_query="select * all from admin_login where user_name='$user_name' and user_password='$user_pass'";
You added * this means all annd behind it you added all again.

use this
PHP
$login_query="select * from admin_login where user_name='$user_name' and user_password='$user_pass'";
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900