Hello friends,

Good Afternoon,
I done the search process in PHP but when it comes to advance search the problem is comming
can anyone help me in programming advance search
and the search has to be performed on more than one table
i require as in http://www.naukri.com/


Thank u

Thanks for giving reply

Iam unable to get the values from different tables and i require those values in a table

Is it possibile for me to guess which tables do required for advanced search? Please post your code or something like that so we can try to solve.

hi
yes this is possible using php
but you need post all value of advance search like a textbox or listbox's value and you need to define dyanamic query

for eg

$keyword=trim($_POST['txt_anykeyword']);
$position=$_POST['list_position'];
$school=$_POST['list_school'];
$subject=$_POST['list_subject'];
$city=$_POST['list_city'];

$query_job = "SELECT  * from fg_postjob where";
				if(trim($position)!='')
				{
					$query_job.=" and  pjob_title = '$position'";
				}
				if(trim($school)!='')
				{
					 $query_job.=" and pjob_school='$school' ";
				
				}
				if(trim($subject)!='')
				{
						 $query_job.=" and pjob_subject='$subject'";
				}
				if(trim($city)!='')
				{
						$query_job.=" and pjob_slocate like('%$city%')";
				}
				if(trim($keyword)!='')
				{
					    $query_job.=" and";
				    	$query_job.=" (pjob_headline like('%$keyword%')";
						$query_job.=" or pjob_title like('%$keyword%')";
						$query_job.=" or pjob_slocate like('%$keyword%')";
						$query_job.=" or pjob_school like('%$keyword%')";
											
					
											    
							 	 $inst_query="select institute_id from fg_institute where institute_name like ('%$keyword%')";
								// echo "<br>instiyute".$inst_query;
						 		 $inst_result=_db_query($inst_query);
						    	 $inst_row=db_fetch_array($inst_result);
								 $keyword_institute=$inst_row['institute_id'];
								
							 if(trim($keyword_institute)!='')
							 {
									$query_job.=" or institute_id like('%$keyword_institute%')";
							 } 
								 
							  $query_job.=" or pjob_description like('%$keyword%')";
							  $query_job.=" or pjob_contact like('%$keyword%')";
							  $query_job.=" or pjob_email like('%$keyword%')";
							  $query_job.=" or pjob_web like('%$keyword%')";
							  $query_job.=" or pjob_essential like('%$keyword%'))";
							  
							 
					
				}

$query_job=str_replace("where and","where",$query_job);
$result_job = _db_query($query_job);
						
					$numrows=db_affected_rows($result_job);
					
					$query_job.=" order by fgpostid desc limit $offset, $rowsPerPage"; 
				    $result_job = _db_query($query_job);

ok $offset and $ropperpage variable used for the paginmg calculation
this is full code for the advance search

i hope this code will solve your problem

Thanks Tulsa
for giving me reply and the code given is good
can u please provide the database and design view of the form please
y because i am bit confused that
u r taking from multiple tables and on different fields
please help me


Thank u

hi
have you not decided database fields yet?
form design is depend on your requirement means which field you want to search means experience,salary,key skill,education etc.
in listbox and text box of html and this form submit to the result.php page. but those field must exist in table which you put in advance search page ok.
where you write dynamic query as i posted here ok.
and if you want to search job then it fnd from posted job's table else if you want to search users then it find from the users table ok


Thanks

Thanks Tulsa

Actually iam new bie to PHP
and i seen ur code
but can u please tell the tables and fields
means database please

Thanks once again

Thanks Tulsa

Actually iam new bie to PHP
and i seen ur code
but can u please tell the tables and fields
means database please

Thanks once again

You are not sure what to search and where to search.

This question has already been answered. Start a new discussion instead.