| | |
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 |
.htaccess ajax apache api array beginner binary broken buttons cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail mediawiki menu mlm mod_rewrite multiple mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search server sessions sms soap source sp space speed sql subdomain syntax system table tag tutorial update upload url validation validator variable vbulletin video web websphere white xml youtube





