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
https://forums.phpfreaks.com/topic/214578-student-help-needed-please/
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;
    }

?>

 

 

 

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.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.