Multiple search

Reply

Join Date: Mar 2008
Posts: 70
Reputation: forzadraco is an unknown quantity at this point 
Solved Threads: 1
forzadraco forzadraco is offline Offline
Junior Poster in Training

Multiple search

 
0
  #1
Mar 13th, 2008
Anyone want to help me to show how make a search with multiple words and condition like or and not..
google search..
Thanks for read my thread..
Ardy Satria H
>email address snipped<
Last edited by MattEvans; Mar 13th, 2008 at 6:28 am. Reason: Removed email address
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 78
Reputation: jino is an unknown quantity at this point 
Solved Threads: 5
jino's Avatar
jino jino is offline Offline
Junior Poster in Training

Re: Multiple search

 
0
  #2
Mar 13th, 2008
You can first create a variable as array like
$query_array=array();

Then u can assign the conditions to these array as string like this..

If ($mob!=' '){
$query_array[]=" personal_mob1 =' ".$mob." 'OR personal_mob2= ' ".$mob." ' ";
}
If ($ser!=' '){
$query_array[]="personal_service1=' ".$ser." ' OR personal_service2=' ".$ser." 'personal_service3=' ".$ser." ' ";
}

// Here $mob and $ser are the variables that get their values from $_post[‘’]
// U want to enter all the fields that u want to search to the $query_array variable..

Now u want to combine these string by the function implode() like…
$query_string=implode("AND", $query_array);

Now u can enter the $query_string variable after the WHERE CALUSE as conditions. Like

SELECT * FROM personal WHERE $query_string;

This will give result satisfying the search criteria..

Hope u can now search anything u want !!
Cheers
Jino..
Last edited by jino; Mar 13th, 2008 at 6:39 am. Reason: For Making More Clear
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 52
Reputation: JeniF is an unknown quantity at this point 
Solved Threads: 5
JeniF's Avatar
JeniF JeniF is offline Offline
Junior Poster in Training

Re: Multiple search

 
0
  #3
Mar 13th, 2008
you can also look at this post for some additional help or options
http://www.daniweb.com/forums/post55...tml#post553273
I keep hitting "escape", but I'm still here!!!!
:}
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC