Jump to content

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.