In my database I have a table named ‘model’. Here is how most of these look like:
iphone 4 16gb white t-mobile
and another:
iphone 4 32gb black kpn
Now I want to select with a query those different iPhones.
$query = mysql_query("SELECT * FROM db WHERE model LIKE '%iphone 4%' AND '%16gb%'") or die(mysql_error());
I want my query to look for “iphone 4” and then look for “16gb”. So it only outputs iPhone 4’s with 16GB. The query above is not working. Is it my syntax? Or is it not possible like this?
Try this query:
You can’t have the following expression in SQL:
You need to state both expressions completely: