SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Supplied argument is not a valid MySQL result resource???

    Hello,

    Okay I know this is a stupid question. I can just feel it. I'm missing something big...

    Anyway, what's wrong with this code?
    PHP Code:
    // get the primary hash variable and insert it
    // into the secret_hash_variable (primary) var
    $hash_query "SELECT * FROM sgf.hashes ORDER BY timestamp DESC LIMIT 1;";
    $query_results mysql_fetch_array($hash_query);

    $secret_hash_variable["primary"] = $query_results["hash"];

    // get the secondary hash variable and insert it
    // into the secret_hash_variable (secondary) var
    $hash_query "SELECT * FROM sgf.hashes ORDER BY timestamp DESC LIMIT 1,1;";
    $query_results mysql_fetch_array($hash_query);

    $secret_hash_variable["secondary"] = $query_results["hash"]; 
    My mysql table structure is this:
    Code:
    mysql>CREATE TABLE hashes (
          ->timestamp TIMESTAMP(14) PRIMARY KEY,
          ->hash VARCHAR(32) NOT NULL
          ->);
    And yet I get the following errors:
    Warning: Supplied argument is not a valid MySQL result resource in c:\web\hidden_variable.php on line 11

    Warning: Supplied argument is not a valid MySQL result resource in c:\web\hidden_variable.php on line 18
    Any help is much appreciated. Thanks.

  2. #2
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to do a mysql_query first, and take out the semicolon in the query string.

  3. #3
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow I feel stupid.

    Thanks a million Anarchos.


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
  •