Help - Search - Members - Calendar
Full Version: Search In Database (3 Values)
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
MrTouz
All i can find on the web is searches for ONE specific value... search for a name in a database, a number or what ever. I can't seem to modify any of these scripts to make them work... i believe i am doing something wrong.

i need a search script to search for 3 different things at the same time :

date
name
number

you have a form to search for someone and you need to put the date, the name, the number and if anyone matches all these 3 criteria... than it shows the result.
On my database (MySql) i have 4 rows (id, date, name, number) and i want to be able to search inside the database but not only for a matching name, or only for a matching
number, i want all 3 data to match and show result.

Anyone knows how to do that ? Also there is something about trimming and addslash... its basically where i get stuck. My head is going to explode.

Thanks !
Ed
Just need to use an AND conjunct within your query:

SQL
SELECT foo FROM bar WHERE a = 'a' AND b = 'b' AND c = 'c'


OR can be used in exactly the same way if you want to match just the one condition.

Hope that helps.
MrTouz
Thanks a lot.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.