LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-31-2010, 01:10 AM   #1
iqra
Member
 
Registered: May 2010
Posts: 34

Rep: Reputation: 15
resourceid #5


helloooo

i am trying this query to compare records of two different tables...
i m geting this message!! no required out put
pplzz somebody help me its really urgent..
values for these ($jobTitle $industry $stationBase $gender $maritalStatus)are coming from textboxes!
here is the code...

PHP Code:
 $query "(SELECT *,
    MATCH(industry, gender, maritalStatus , typeofWorkPosition , preferCity) AGAINST ('
$jobTitle $industry $stationBase $gender $maritalStatus' IN BOOLEAN MODE) AS RELAVENCE 
          FROM membership_form 
       WHERE MATCH(industry, gender, maritalStatus , typeofWorkPosition , preferCity) 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>"
      }  
    while (
$row=mysql_fetch_array($result)>0
        {
            echo 
$row[0];
            } 

Last edited by iqra; 12-31-2010 at 02:30 AM.
 
Old 01-01-2011, 09:41 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Quote:
Originally Posted by iqra View Post
helloooo

i am trying this query to compare records of two different tables...
i m geting this message!! no required out put
pplzz somebody help me its really urgent..
What is the message? "No required output"? "Resource id #5"? Or something else? With regards to the code, it's "AS relevance" not "AS RELAVENCE" (I don't know if capitalisation matters, but spelling does ) Also, do you definitely want to be using BOOLEAN MODE? I haven't used MATCH() before, but the docs seemed to suggest that certain words are considered 'key words' and also that small words are ignored. Perhaps using the NATURAL LANGUAGE MODE would be better - but you probably know more about it than me... I got the impression BOOLEAN MODE was for doing clever things like searching for strings which don't have X in but do have Y in

Hope this helps,
 
Old 01-03-2011, 05:58 AM   #3
iqra
Member
 
Registered: May 2010
Posts: 34

Original Poster
Rep: Reputation: 15
thnx for the reply Snark1994

out put was "Resource id #5".
and now i changed my code a bit actual there was problem with my other code where i was getting input from previous page.
and i also changed the word AS RELAVENCE. i am using "As score" now... any how thanks for pointing out the error i will remember it for the next tym

now I am getting my desired out put but still along with that output resourceid #5 is coming on a side..

heres my new code that is giving right output..but resourceid #5 along with it!

Code:
 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, gender, maritalStatus, typeofWorkPosition, preferCity) AGAINST ('$industry $gender $maritalStatus $jobTitle  $stationBase' IN BOOLEAN MODE) AS score 
          FROM membership_form 
       WHERE MATCH(industry, gender, maritalStatus, typeofWorkPosition, preferCity) AGAINST ('$industry $gender $maritalStatus $jobTitle  $stationBase' IN BOOLEAN MODE)";
	 //  echo $query;
	   
      $result = mysql_query($query);
	    echo $result;
	  if(!$result) { 
         echo mysql_error()."<br>$query<br>"; 
      }  
	if(mysql_num_rows($result)>0) 
		{	
		 while($row = mysql_fetch_array($result)) {
			$memberNo = $row['memberNo'];
			?>
HOPE you got my point what I am trying to ask!!
and about using Boolean mode... you are right about that... but i am using it here to give preference to some words( in match clause) AS in my if conditions I have used + and - signs to those words that must be included in search and words that have less priority relatively.
this is what I Know about using Boolean mode.. I can b wrong here..
 
Old 01-03-2011, 09:01 AM   #4
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

I'm not sure if I understand, but "resourceid #5" comes from the line "echo $result;". It doesn't make sense to echo a database result, but when you do, the conversation from "resource" to string behaves like that. Just remove that line.
 
Old 01-05-2011, 06:56 AM   #5
iqra
Member
 
Registered: May 2010
Posts: 34

Original Poster
Rep: Reputation: 15
waoo thnx Guttorm!

its fine now... Resource ID # is Removed now.!!

Regards!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration