MySQL query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hanzo
Forum Newbie
Posts: 16
Joined: Thu Nov 17, 2005 10:14 am

MySQL query

Post by hanzo »

Code: Select all

$query = "SELECT `name` FROM `users` WHERE product = 'ipod video 60gb'AND activated = '1' ORDER BY `order` ASC";
I have this query but it should also return rows where activated = 2 how do I do that?

Thanks
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Code: Select all

$query = "SELECT `name` FROM `users` WHERE product = 'ipod video 60gb' AND (activated = '1'  or activated = '2') ORDER BY `order` ASC";
hanzo
Forum Newbie
Posts: 16
Joined: Thu Nov 17, 2005 10:14 am

Post by hanzo »

thanks 8)
dreamline
Forum Contributor
Posts: 158
Joined: Fri May 28, 2004 2:37 am

Post by dreamline »

A little bit shorter would be:

Code: Select all

$query = "SELECT `name` FROM `users` WHERE product = 'ipod video 60gb' AND activated in ('1','2') ORDER BY `order` ASC";
Just my 2 cents.. :)
Post Reply