Mysql SELECT Help needed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • archael
    Registered User
    • Jun 2003
    • 51

    #1

    Mysql SELECT Help needed

    first of all my script is a perl script. It takes a query in the environment and cuts it into exactly what i want. Can be a combination of up to 3 search terms and a category. There is no problem there.

    On my SELECT part for my query, something goes wrong.

    All my terms are always perfect whether only 1 or 3 or even none are present.

    Here is what i have:

    SELECT * FROM Table WHERE description like '%$search%' OR description like '%$search2%' order by ID limit 0,144;

    When i have only 1 search term its fine, when i have 2 or 3 it messes up, have no idea why.

    Anyone might know?

    Jon
  • raymor
    Confirmed User
    • Oct 2002
    • 3745

    #2
    Try printing out the query, as it's seen by MySQL:
    $query = "SELECT * FROM Table WHERE description like '%$search%' OR description like '%$search2%' order by ID limit 0,144"
    print "query: $query\n";

    Also what does "it doesn't work" mean?
    Do you get an error message? If so, what does it say?
    DO you just not get the results you expected?

    I suspect that if you read the query that gets printed
    aloud and translate it into English you'll see where your problem is.
    I could just tell you, but I'd rather teach you how to find it.
    Last edited by raymor; 09-23-2004, 11:01 PM.
    For historical display only. This information is not current:
    support@bettercgi.com ICQ 7208627
    Strongbox - The next generation in site security
    Throttlebox - The next generation in bandwidth control
    Clonebox - Backup and disaster recovery on steroids

    Comment

    • archael
      Registered User
      • Jun 2003
      • 51

      #3
      thanks a lot for helping out bro, its working now thanks to you ;)

      Jon

      Comment

      Working...