hiii ALL!!

I have to match/compare fields of one table with the fields of another table. basically m i have to search a record from another tables using some fields of a different table.

for exmple I have two tables.
Table 1: newjobs
table 2: employer form

Table 1 newjobs contains (Job Id, job title, industy...etc)
Table2 employer form contains( same fields as above but with a bit different names)

i have to check whether records of new job matches with that of employer form.

I am applying full text search... match().. and against()... queries..

but it always show no result..

heres the query m writing....

<?        
            $jobTitle = $_POST['jobTitle'];
			$industry = $_POST['industry'];
			$stationBase = $_POST['stationBase'];
			$gender = $_POST['gender'];
			$maritalStatus = $_POST['maritalStatus'];
		
               
				 mysql_select_db("a2z");
   if((!$jobTitle) || ($jobTitle == "")) { $jobTitle = ""; } else { $jobTitle = "+(".$jobTitle.")"; }
   if((!$industry) || ($industry == "")) { $industry = ""; } 
   if((!$stationBase) || ($stationBase == "")) { $stationBase = ""; } else { $stationBase = "+(".$stationBase.")"; }
   if((!$gender) || ($gender == "")) { $gender = ""; } 
   if((!$maritalStatus) || ($maritalStatus == "")) { $maritalStatus = ""; } 
   
   $query = "SELECT *,
    MATCH(industry, typeofWorkPosition, preferCity, spouse, gender) AGAINST ('$jobTitle $industry $stationBase $gender $maritalStatus' IN BOOLEAN MODE) AS RELAVENCE 
          FROM membership_form 
       WHERE MATCH(industry, typeofWorkPosition, preferCity, spouse, gender) AGAINST ('$jobTitle $city $industry $stationBase $gender $maritalStatus' IN BOOLEAN MODE)";
	   //echo $query;
	   
      $result = mysql_query($query);
     echo $result;
	  if(!$result) { 
         echo mysql_error()."<br>$query<br>"; 
      }  
	  if($row=mysql_num_rows($result) > 0) {
          echo $row;
		  }
		  else echo "sorryyyyyyyyy";
		  
		    ?>

pleaseeeeeee somebody tell me wats wrong with this.. I must be missing something really important.. do i have to use JOINS???

any help would be appreciated...!!!

<?php
$jobTitle = $_POST;
$industry = $_POST;
$stationBase = $_POST;
$gender = $_POST;
$maritalStatus = $_POST;



mysql_select_db("a2z");
if((!$jobTitle) || ($jobTitle == "")) { $jobTitle = ""; } else { $jobTitle = "+(".$jobTitle.")"; }
if((!$industry) || ($industry == "")) { $industry = ""; }
if((!$stationBase) || ($stationBase == "")) { $stationBase = ""; } else { $stationBase = "+(".$stationBase.")"; }
if((!$gender) || ($gender == "")) { $gender = ""; }
if((!$maritalStatus) || ($maritalStatus == "")) { $maritalStatus = ""; }


$query = mysql_query("SELECT *,
MATCH(industry, typeofWorkPosition, preferCity, spouse, gender) AGAINST ('$jobTitle $industry $stationBase $gender $maritalStatus' IN BOOLEAN MODE) AS RELAVENCE
FROM membership_form
WHERE MATCH(industry, typeofWorkPosition, preferCity, spouse, gender) AGAINST ('$jobTitle $city $industry $stationBase $gender $maritalStatus' IN BOOLEAN MODE)");
//echo $query;


$result = mysql_fetch_array($query);
echo $result;
if(!$result) {
echo mysql_error()."<br>$query<br>";
}
if($row=mysql_num_rows($result) > 0) {
echo $row;
}
else{ echo "sorryyyyyyyyy";
}
?>

Try that hope it helps, the errors I seen was your last else did not include a { which would also have to be ended after your echo with } - I also do my database queries a tad different if it causes a problem then just fix the else and see how that works.

No its not working still same problem
this what i get in out put
Resource id #5

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\wamp\www\a2z\admin\searchjobseeker.php on line 53
sorryyyyyyyyy

I have also tried uniion between these two tables that also gives the same result..

i have not used any foreign keys here... is it because of that my query is not working properly????

Sorry small error I think, I used $result after mysql_num_rows, that should in fact say $query so try: mysql_num_rows($query)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.