943,796 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1502
  • PHP RSS
Mar 13th, 2008
0

Multiple search

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
forzadraco is offline Offline
70 posts
since Mar 2008
Mar 13th, 2008
0

Re: Multiple search

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
Reputation Points: 10
Solved Threads: 10
Junior Poster
jino is offline Offline
114 posts
since Feb 2008
Mar 13th, 2008
0

Re: Multiple search

you can also look at this post for some additional help or options
http://www.daniweb.com/forums/post55...tml#post553273
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
JeniF is offline Offline
52 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Stupid Newbie Needs Help w/xml_parse
Next Thread in PHP Forum Timeline: Help with parse and undefined errors





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC