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