3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by JeniF
0

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..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.