Results 1 to 3 of 3

Thread: supplied argument is not a valid MySQL result resource

  1. #1
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default supplied argument is not a valid MySQL result resource

    I am getting these errors when trying to complete the registration for the game:

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/usr/public_html/folder/subfolder/mainmenu.php on line 35

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/usr/public_html/folder/subfolder/mainmenu.php on line 65

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/usr/public_html/folder/subfolder/mainmenu.php on line 109
    Invalid Nick/Password


    I have searched and prodded and changed everything I can think of and it only gets worse.

    Here are the lines:

    Line 35:
    Code:
    /* for each older game... */
    	while($tmpOldGame = mysql_fetch_array($tmpOldGames, MYSQL_ASSOC))
    	{
    		/* ... clear the history... */
    		mysql_query("DELETE FROM history WHERE gameID = ".$tmpOldGame['gameID']);
    
    		/* ... and the board... */
    		mysql_query("DELETE FROM pieces WHERE gameID = ".$tmpOldGame['gameID']);
    		
    		/* ... and the messages... */
    		mysql_query("DELETE FROM messages WHERE gameID = ".$tmpOldGame['gameID']);
    		
    		/* ... and finally the game itself from the database */
    		mysql_query("DELETE FROM games WHERE gameID = ".$tmpOldGame['gameID']);
    	}
    Line 65:
    Code:
    if (mysql_num_rows($existingUsers) > 0)
    			{
    				require 'newuser.php';
    				die();
    			}
    and line 109: (actually 105 - 109)
    Code:
    		case 'Login':
    			/* check for a player with supplied nick and password */
    			$tmpQuery = "SELECT * FROM players WHERE nick = '".$_POST['txtNick']."' AND password = '".$_POST['pwdPassword']."'";
    			$tmpPlayers = mysql_query($tmpQuery);
    			$tmpPlayer = mysql_fetch_array($tmpPlayers, MYSQL_ASSOC);
    Any help as to a fix for these? Thanks a lot!



    <EDIT> Okay, you know what, lets pretend for a moment that I am NOT stupid.. cause really I am not, although apparently I can not prove it. When you get the Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource error, it means you are not connecting to the db, right? Well knowing that, I double checked my config.php, and found the dang typo I had in there. Fixed the typo and everything is great! Sorry for being dumb, but I am going to leave this post to show other people how to solve this problem so they don't have to look dumb in public like I seem to be getting used to. *sigh* </EDIT>
    Last edited by BLiZZaRD; 03-04-2006 at 05:39 PM.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Where is $tmpOldGames defined? Make sure it's returning true.
    Sounds like your mysql_connect() and/or mysql_select_db() call(s) is/are failing somewhere.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Thanks Twey, you were probably reading or answering when I edited. The problem was a stupid tiny little typo in my db name in the config.php.

    I did fix it though and all works well!

    Now if I can get a little help with my other script in this php forum I think I will be all set for a while


    Thanks again!
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

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
  •