How can I specify to fetch all rows with at least one matchi

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
aneuryzma
Forum Contributor
Posts: 106
Joined: Sat May 17, 2008 7:03 am

How can I specify to fetch all rows with at least one matchi

Post by aneuryzma »

How can I specify to fetch all rows with at least one matching field ?

Code: Select all

$result = mysql_query("SELECT * FROM Users WHERE Field1 = 'value1' or Field2= 'value2'  ");
Thanks
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: How can I specify to fetch all rows with at least one ma

Post by Eric! »

It seems you answered your own question. Did that not work?
genix2011
Forum Commoner
Posts: 74
Joined: Tue Aug 02, 2011 4:00 pm

Re: How can I specify to fetch all rows with at least one ma

Post by genix2011 »

Hi,

at least one? if there is nothing matching your condition, then there can't be anything returned by mysql.

if you want to limit your result to one row, that is possible with the LIMIT keyword.

Greets.
Post Reply