Web Analytics Made Easy -
StatCounter using LIKE in 2 rows? - CodingForum

Announcement

Collapse
No announcement yet.

using LIKE in 2 rows?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • using LIKE in 2 rows?

    I have the following snippet of code:

    Code:
    $query = "select * from offers where name like \"%$trimmed%\"  
      order by name"; // EDIT HERE and specify your table and field names for the SQL query
    how would i make it so its
    Code:
    where name like \"%$trimmed%\" AND country like \"%us%\"
    thanks
    Ever want to see inside of a rave? Check out RedRoll and join our community of EDM lovers and rave fanatics.

  • #2
    You just did.

    Excepting that normally we use apostrophes to delineate strings in SQL code. (Some databases, other than MySQL won't even accept quotes.)

    Code:
    $query = "SELECT * FROM  offers WHERE name LIKE '%$trimmed%' AND country LIKE '%us%' ORDER BY name";
    Why didn't you just try it?
    Be yourself. No one else is as qualified.

    Comment


    • #3
      bahahaha, found the error. i was putting country when it was countries
      Last edited by markman641; Aug 27, 2011, 02:06 PM.
      Ever want to see inside of a rave? Check out RedRoll and join our community of EDM lovers and rave fanatics.

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎