Jump to content

Student help needed please


jamesyrawr

Recommended Posts

Hi

I get the following error when running this file.

Fatal error: Call to undefined function mysqql_query() in C:\wamp\www\Isis\login.php on line 14]

 

I'm not sure if i have missed something or typed something wrong but a second opinion is always better :)

 

<?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 = mysqql_query("SELECT count(id) FROM obsosuser WHERE username='$username' and password='$password'");
        
        if ($result!=1){
            echo "Invalid Login!";
            
        } else
            echo "Login Successful! Welcome back ".$_COOKIE['username']." Sir/Maddam." ;
            $_SESSION ['username'] = $username;
    }

?>

Thanks

Link to comment
Share on other sites

Thanks

 

knew i had missed something

although

i'm getting another error message

Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\wamp\www\Isis\login.php on line 16

 

<?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;
    }

?>

 

 

 

Link to comment
Share on other sites

The defintion of mysql_result() -

string mysql_result ( resource $result , int $row [, mixed $field = 0 ] )

 

Assuming that the code you posted is the code producing the error, it means that your query failed due to an error and returned a FALSE value.

 

For debugging purposes, echo mysql_error(); on the next line after the line with your mysql_query() statement, it will tell you why the query failed.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.