View Full Version : using LIKE in 2 rows?

08-27-2011, 07:39 AM
I have the following snippet of 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
where name like \"%$trimmed%\" AND country like \"%us%\"


Old Pedant
08-27-2011, 09:42 AM
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.)

$query = "SELECT * FROM offers WHERE name LIKE '%$trimmed%' AND country LIKE '%us%' ORDER BY name";

Why didn't you just try it?

08-27-2011, 08:04 PM
bahahaha, found the error. i was putting country when it was countries