sql&php请给出这个错误解决方案[重复]

<?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)>0){     
$_SESSION['user_name']=$user_name;  
echo "<script>window.open('index.php','_self')</script>";  
} else {  
echo "<script>alert('User Name or Password is incorrect!')</script>";    } }    ?>

This error shows that

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\malala\admin\login.php on line 8

</div>

you have to set a connection first(mysql_connect("loclahost","root","","db_name)) in the mysql_query you need 2 parameters 1-connection and 2-query. the error means function cant find any row.

your query must be like this:

$login_query = "SELECT * from admin_login where user_name='$user_name' AND user_password='$user_pass' ";