• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 517
  • Last Modified:

PHP/MySQL multiple textbox's search one record

Ive got a php/mysql app that im tryin to search results on one record from up to 5 textboxes.

The results processor php page has this:

$query = ("SELECT * FROM tableA
WHERE contid LIKE '$contid%'
AND city LIKE '$city%'");

The PHP search form ive got 5 textboxes that i would like to be able to punch in up to 5
ID's in:
The actual record name in the table is contid.

Textbox1 name is contid
Textbox2 name is contid2
Textbox3 name is contid3 and so on up to 5

Can i put an AND/OR statement in the processor page to query also the contid2 and so on?

Any help would be appreciated, thanks


0
cybrthug
Asked:
cybrthug
1 Solution
 
Harisha M GCommented:
$query = ("SELECT * FROM tableA
WHERE (contid LIKE '$contid%' OR
contid LIKE '$contid2%' OR
contid LIKE '$contid3%' OR
contid LIKE '$contid4%' OR
contid LIKE '$contid5%')
AND city LIKE '$city%'");

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now