Jump to content

resource id #13


mdmartiny

Recommended Posts

Hello everyone,

 

I am writing some code for a login script. I keep getting the error Resource ID #13. What does this mean and how can I fix it?

 

Here is the code that I am having trouble with

function user_id_from_username($username) {
    $username = sanitize($username);
    $query = mysql_query("SELECT `user_id` FROM `users` WHERE `username` = '$username'");

    return mysql_result($query, 0, 'user_id');
}

function login($username, $password) {
    $user_id = user_id_from_username($username);

    $username = sanitize($username);
    $password = md5($password);

    $query = "SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username' AND `password` = '$password'";

    return (mysql_result(mysql_query($query), 0) == 1) ? $user_id : false;
}

Link to comment
https://forums.phpfreaks.com/topic/262656-resource-id-13/
Share on other sites

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.