Jump to content

[SOLVED] query string with multiple values in one table


Photobrad.com

Recommended Posts

I'm having trouble with the syntax on a query string, and haven't been able to find any posts or tutorials that seem to address this specific  type of query.

 

I have a table named "items" with a field for "name"

 

In the "name" field, I have several different entries (actual data), including John, Mark, Sue, Brian, Lucy, etc.

 

In the specific page I'm building, I want to query the database and return the data for more than one person, but not everyone.

 

It seems the query string should be:

 

	$query="SELECT * FROM items WHERE name='Brian' AND name='Sue' ORDER BY name ASC"; 

 

However I get errors. If I remove the "AND name='Sue'" it returns data for Brian just fine, and if I remove "name='Brian' AND" it returns data for Sue, but I can't get it to return the data for both of them.

 

Am I missing something obvious?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.