what this error mean

Discussion in 'MySQL' started by unlisted80, Dec 5, 2006.

  1. #1
    Hi

    what is this error mean

    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /homeaddress... line 20..etc.


    Thanks advance
     
    unlisted80, Dec 5, 2006 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,832
    Likes Received:
    4,541
    Best Answers:
    123
    Trophy Points:
    665
    #2
    It means that you haven't provided a $result variable from a previous query.

    Can you paste a few lines from your script at about that point?
     
    sarahk, Dec 5, 2006 IP
  3. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #3
    probably the query syntax is incorrect, do or die(mysql_error()) on the ends of anyting mysql to find out....
     
    krakjoe, Dec 5, 2006 IP
  4. unlisted80

    unlisted80 Peon

    Messages:
    644
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi

    Thanks for replied

    this is the line that i have problem with

    Thank
     
    unlisted80, Dec 5, 2006 IP
  5. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #5
    change
    $qresult = mysql_query("SELECT * FROM t_media WHERE m_type='".$type."' AND m_submapproved='Y' ORDER BY m_id DESC LIMIT $mediaLimit");
    Code (markup):
    to
    $sql = "SELECT * FROM t_media WHERE m_type='".$type."' AND m_submapproved='Y' ORDER BY m_id DESC LIMIT $mediaLimit";
    echo $sql;
    exit;
    $qresult = mysql_query($sql);
    Code (markup):
    then paste the line it echoes.....
     
    krakjoe, Dec 5, 2006 IP
  6. Scolls

    Scolls Guest

    Messages:
    70
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Also, do check whether or not $qresult is actually not null. I would usually put:
    if ($qresult!=null) {
    //work with the result

    //final cleanup - release memory
    mysql_free_result($qresult);
    }
     
    Scolls, Dec 5, 2006 IP