| | |
Multiple search
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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..
$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
you can also look at this post for some additional help or options
http://www.daniweb.com/forums/post55...tml#post553273
http://www.daniweb.com/forums/post55...tml#post553273
I keep hitting "escape", but I'm still here!!!!
:}
:}
![]() |
Similar Threads
- PHP Ajax Search (PHP)
- PHP search option remove (PHP)
- multiple search terms+fulltext search (MySQL)
- multiple search (Visual Basic 4 / 5 / 6)
- Search Engine Manager needed (Internet Marketing Job Offers)
- VB6 - "FindFirst" with multiple search Criteria (Visual Basic 4 / 5 / 6)
- Multiple Domain Web Site Hosting by HforHosting.com (Website Reviews)
Other Threads in the PHP Forum
- Previous Thread: Stupid Newbie Needs Help w/xml_parse
- Next Thread: Help with parse and undefined errors
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube





