SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2002
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    error when doing a search

    hello I get this error after looking for a word in my search script

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

    here is the code:
    PHP Code:
    $query "SELECT * FROM search HAVING MATCH (keywords) AGAINST ('$search') GROUP BY head2";
    $result mysql_query($query);
    while(
    $a_row mysql_fetch_array($result)) {
    echo 
    "<tr><td background=images/newpage2/bg.gif width=5 height=19></td><td width=384>";
    echo 
    $a_row['head2'];
    echo 
    "</td><td background=images/newpage2/bg2.gif width=5 height=19></td></tr>";
    $cat $a_row['head2'];
    $query2 "SELECT * FROM search WHERE head2 = '$cat'";
    $result2 mysql_query($query2);
    while(
    $b_row mysql_fetch_array($result2)) {
    echo 
    "<tr><td background=images/newpage2/bg.gif width=5 height=19></td><td width=384>";
    echo 
    "<a href="http://www.whatever.com/$b_row[head].php?id=$b_row[sid]">$b_row[display]</a>";
    echo "</td><td background=images/newpage2/bg2.gif width=5 height=19></td></tr>";
    }


  2. #2
    SitePoint Addict The Mog's Avatar
    Join Date
    Dec 2002
    Location
    Manchester UK
    Posts
    310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you sure that "HAVING MATCH" is a mysql statment ????


    the mog

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2002
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not to sure about that...I had WHERE before and I still got the same error

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2002
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I take out GROUP BY head2 and put in WHERE I don't get the error but then I don't get anything to display


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
  •