[SOLVED] php Query problem, dunno how to call it :s

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
potato
Forum Contributor
Posts: 192
Joined: Tue Mar 16, 2004 8:30 am
Location: my lovely trailer, next to the big tree

php Query problem, dunno how to call it :s

Post by potato »

Hi evrybody!

Is there a way that i can make a 'where blahblah = annything query'? If you get what i mean.
For example:

this way, i select everything where active = 1 and genre1 = $genre or genre2 = $genre

Code: Select all

$query = "SELECT * FROM bands WHERE active = 1 AND genre1 = '$genre' OR genre2 = '$genre'";

this i what i think it should be, but doesn't work.
Select everything where active = 1 and genre1 = (annything) or subgenre = (annything)

Code: Select all

... WHERE active = 1 AND genre1 = * OR genre2 = * ";

I hope there is a way to do it, would be very helpfull.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Code: Select all

Code: 
... WHERE active LIKE '%' AND genre1 LIKE '%' OR genre2 LIKE '%' ";
User avatar
potato
Forum Contributor
Posts: 192
Joined: Tue Mar 16, 2004 8:30 am
Location: my lovely trailer, next to the big tree

Post by potato »

Thank you very much. :D
Post Reply