mysql_num_rows($sql) == 1

User authorization script

<?php if (isset($_POST['login']) && isset($_POST['password']))
{
    $login = mysql_real_escape_string($_POST['login']);
    $password = ($_POST['password']);
    //    
    $link = mysql_connect("localhost", "root", "") or die("Could not connect: " . mysql_error());
    mysql_select_db("money", $link) or die (mysql_error());
    //        
    $query = "SELECT `id`
            FROM `vxod`
            WHERE `login`='{$login}' AND `password`='{$password}'
            LIMIT 1";
    $sql = mysql_query($query) or die(mysql_error());
    //    
    if (mysql_num_rows($sql) == 1) {
        //         (    ID )
        $row = mysql_fetch_assoc($sql);
        $_SESSION['user_id'] = $row['id'];
 $linkus = "sdsdsdsd";
 echo $linkus;
    }
    else {
        die('        .      .');
    }
}
session_start()
?>
    ?
if (mysql_num_rows($sql) == 1)

And how to remove the authorization form after the user logs in?


Answer 1, authority 100%

mysql_num_rows– returns the number of rows returned by the MySQL server for your query

session_start()-       !
     -     ,        SQL  -