SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot JagXJ220's Avatar
    Join Date
    Mar 2001
    Location
    Not worth the drive
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm using this code to verify users from a form:

    Code:
    <?
    session_start();
    $login_result = mysql_query("SELECT * FROM members WHERE userid='$login_userid' AND userpass='$login_userpass'"); 
    if (mysql_num_rows($login_result)==1) { 
    $logged_in = "yes";
    $logged_in_user = $login_userid;
    $logged_in_pass = $login_userpass;
    session_register('logged_in');
    session_register('logged_in_user');
    session_register('logged_in_pass');
    }
    ?>
    When I try to login it gives me this error:

    Warning: Supplied argument is not a valid MySQL result resource in /home/super/public_html/phpnetwork/login.php on line 4

    I can't figure out what's going on. Could someone help me out?

  2. #2
    SitePoint Zealot DarkMonkey's Avatar
    Join Date
    Apr 2001
    Location
    uk
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well you'll need to actually connect to mysql and your database first... Normally I would assume you have done that, but if the error was line 4 then that fits with your code... So...

  3. #3
    SitePoint Zealot JagXJ220's Avatar
    Join Date
    Mar 2001
    Location
    Not worth the drive
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, that code was in its own file which was included in my main page using the require() function. In the main page, a connection to the database is already established.

  4. #4
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try using include() instead of require()

  5. #5
    SitePoint Zealot DarkMonkey's Avatar
    Join Date
    Apr 2001
    Location
    uk
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right, okay, my first reaction, that's all


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •