Search function does not work if there are too many results

Discussion in 'PHP' started by baris22, Feb 22, 2009.

  1. #1
    hello,

    if i get a special character in result from the search it does not work

    I get this error

    
    
    Warning: mysql_query() [function.mysql-query]: Unable to save result set in /home/xxx/public_html/search.php on line 277
    
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/search.php on line 278
    
    
    
    PHP:
    If there is no special character in results it works perfect. What can i do to find the special character? this is the code i am using.

    
    
    $query = "select * from  files where title like \"%$trimmed%\"  
      order by added desc"; // 
    
     $numresults=mysql_query($query);
     $numrows=mysql_num_rows($numresults);
    
    PHP:
    Any suggestions?
     
    baris22, Feb 22, 2009 IP
  2. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #2
    Try to minimize the results using LIMIT 0,10, make pagination.

    Peace,
     
    Barti1987, Feb 22, 2009 IP
  3. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
    #3
    wmtips, Feb 22, 2009 IP
  4. baris22

    baris22 Active Member

    Messages:
    543
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #4
    checked it. It is the latest version I have got


    That is what i am doing. But it is not showing any results at all.
     
    baris22, Feb 22, 2009 IP
  5. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
    #5
    Try to repair your tables, try a tip from the url given above:

     
    wmtips, Feb 22, 2009 IP
  6. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #6
    I've had a file with more than 8,000,000 entries and never saw similar errors .. What's your MySQL client version ?
     
    ActiveFrost, Feb 23, 2009 IP
  7. innovatewebs

    innovatewebs Well-Known Member

    Messages:
    194
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #7
    please check your mysql temp dir may it is full
    clear it and then try to run sql.
     
    innovatewebs, Feb 23, 2009 IP
  8. websecrets

    websecrets Peon

    Messages:
    97
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    How big is this database you are searching through?

    What "special characters" does it fail on?
     
    websecrets, Feb 23, 2009 IP