Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2006

    Unanswered: MySQL "OR" Statement Question

    Hey there,

    I'm working on a script that selects a list of schools, and displays them according to the user's specified criteria.

    Here's the query I'm using at the moment

    "SELECT * FROM hs_ajax_suggest WHERE hsName LIKE '".$param."%' OR hsCity LIKE '".$param."%' OR hsState LIKE '".$param."%' LIMIT 10")
    This seems really wrong to me. I don't even know if "OR" is a valid statement. I'd like to know how to get a more structured query, and a more relevant response from this query.

    Do you guys have any suggestions?


  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    it's not really wrong

    OR is a valid keyword -- it's a logical connector

    that query is structured fine

    "more relevant response" would need to be defined before i can comment on it | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts