Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Posts
    417
    Thanks
    168
    Thanked 1 Time in 1 Post

    mysql_result error?

    Well I am going on my 17th hour of straight coding today... and i cant seem to see why i am getting this error:

    Code:
    $getCreatorUsername="SELECT username FROM ausers WHERE userID=$creatorUserid";
    
    echo '<p>'.$getCreatorUsername; // returns the proper field nicely
    
    $resultCreatorUsername = mysql_query($sqlCreatorUsername);
    
    $creatorUsername=mysql_result($resultCreatorUsername,0,0); // this is the error line
    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/path/www/groups/join.php on line 119

    looks good to me!

  • #2
    Regular Coder
    Join Date
    Dec 2006
    Posts
    417
    Thanks
    168
    Thanked 1 Time in 1 Post
    the line: echo '<p>'.$getCreatorUsername;

    outputs:

    SELECT username FROM ausers WHERE userID=1

    and the result is one VARCHAR field: 'dude'

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You don't have any error checking so your query could be failing.
    PHP Code:
    $resultCreatorUsername mysql_query($sqlCreatorUsername) or die(mysql_error()); 
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Well I am going on my 17th hour of straight coding today... and i cant seem to see why i am getting this error:
    Code:
    $getCreatorUsername="SELECT username FROM ausers WHERE userID=$creatorUserid";
    
    echo '<p>'.$getCreatorUsername; // returns the proper field nicely
    
    $resultCreatorUsername = mysql_query($sqlCreatorUsername);
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Bobafart (03-04-2008)


  •  

    Posting Permissions

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