hey
i seem to get this everytime i run this file within my login script
Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\wamp\www\Isis\login.php on line 16
can anyone help me please?
heres my code

<?php


    $username = $_POST['username'];
    $password = $_POST['password'];
    $login = $_GET['login'];
    
    setcookie("username", "$username", time()+86400);

    if ($login=='yes') {
        $con = mysql_connect("localhost","root","");
        mysql_select_db("obsosuser");
        
        $get = mysql_query("SELECT count(id) FROM obsosuser WHERE username='$username' and password='$password'");
        
        $result = mysql_result($get, 0);
        if ($result!=1){
            echo "Invalid Login!";
            
        } else
            echo "Login Successful! Welcome back ".$_COOKIE['username']." Sir/Maddam." ;
            $_SESSION ['username'] = $username;
    }

?>

Thanks

Nevermind...Im wrong :(

<?php


    $username = $_POST['username'];
    $password = $_POST['password'];
    $login = $_GET['login'];
    
    setcookie("username", "$username", time()+86400);

    if ($login=='yes') {
        $con = mysql_connect("localhost","root","");
        mysql_select_db("obsosuser");
        
        $sql = "SELECT count(id) FROM obsosuser WHERE username='$username' and password='$password'";
        $query = mysql_query($sql);   
		$result = mysql_num_rows($query);  

        if ( $result == 1 ) 
		{
			echo "Login Successful! Welcome back ".$_COOKIE['username']." Sir/Maddam." ;
            $_SESSION ['username'] = $username;
		}
		else
		{
			echo "Invalid Login!";
		}
    }
?>

Try this code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.