SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Query Gets Too Many Results

    I have a search on my site that searches through our business database, its looks through the website title, site description and a list of keywords entered into the keyword field. The search is based on what the user inputs and does a LIKE %input% query.

    Its hard to explain this without saying how its lists the results.

    There are three memberships to our market, all of them are loaded into one database. The only difference is in the status field it states wheather it is a New, Silver or Gold Member. The gold members show up in the listings first, then the silver, then the New members.

    This is my query:

    mysql_query("SELECT * FROM calgary WHERE title like '%$input%' or discription like '%$input%' or keywords like '%$input%' and status='Gold' ORDER by title LIMIT $start_entry,$list",$db);

    Thats the first query to list the golds first. It lists them and then does the silver members next. The only thing changed for that is the status=' '

    This is my Problem:

    This query gets all the business's in the database that are Like %whatever% in the title, description or keywords, and pretty much ignors the status=''

    So it shows the same listings for gold, silver and new.

    I would be very glad is someone can help me with this. If you need any more information please let me know.

  2. #2
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Try this....

    make a variable called statusGold.
    Make it look like this:

    $statusGold = "Gold";

    now put into your query status='$statusGold'
    and see what that gives you


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
  •