Jump to content

need help with query result, compare or something


HAVOCWIZARD

Recommended Posts

hi all still new at this cant get the commands to work, have a query and im trying to filter or compare or anything that will only give me one result of the record that have the spesific words in, im running a full search...

 

// strings to remove from lists

$removal_strings = array("(", ")", "[", "]");

 

// create sql query for search

$sql_query  = "select register_companyName from $register_table where ";

$sql_query .= "MATCH (register_companyName,

register_Mcat,

register_keyword1,

register_keyword2,

register_keyword3,

register_keyword4,

register_keyword5,

register_keyword6,

register_keyword7,

register_keyword8,

register_keyword9,

register_keyword10,

register_area,

register_suburb,

register_province,

register_country)";

 

$sql_query .= "AGAINST ('" . $_POST["inputTxt"] . " in boolean mode');";

 

$search_full = rundbquery($sql_query);

$words = addslashes(str_replace($removal_strings, "", $_POST["inputTxt"]));

$found = explode(" ", $words);

$found1 = $found[0];

$found2 = $found[1];

 

********************************************************

while($found1 = $search_full)

{

 

 

printr ($found);

printr ($search_full);

}

***********************************************************8

 

dont work just loops i have tride to filter nothing what is wrong, if anybody can help pls...the problem is where the ** are.. thanks

Link to comment
Share on other sites

Is there any errror displayed?

 

afaik you can only use "MATCH" If you've definded an index...

 

what kind of data does rundbquery($sql) return?

 

maybe use $found1=mysql_fetch_object($search_full);

Link to comment
Share on other sites

Make sure you have a full text index on all columns you are using in your MATCH query.

 

Also, check to see what rundbquery() does on an error...does it just return?  Does it throw an error, but continue execution?  Does it stop execution?

 

If in doubt, use mysql_query() with a die on the end.

 

$search_full = mysql_query($sql_query) or die(mysql_error());

 

What does rundbquery() return?  An object?  An array?

 

Your while loop is infinite...you will always be able to set one var equal to another...you want something like:

 

while ($found1 = mysql_fetch_assoc($search_full)) {
      printr ($found);
      printr ($search_full);
}

 

or

 

foreach ($search_full as $found1) {
      printr ($found);
      printr ($search_full);
}

 

Depending on what your rundbquery returns (a mysql object, a set of object rows, or an array).

Link to comment
Share on other sites

thanks that first one worked, now i need to filter the result form that, search "game hoedspruit", so if the record has all these words then it should display it....

 

i can see again the loop is gone lol, thanks...now the compare or filter , what will work the best ?

Link to comment
Share on other sites

Format will be like this

 

(match(UrlKeyWord.Keyword) against('keyword1') OR match(keyword) against('*keyword1' IN BOOLEAN MODE))
OR
(match(UrlKeyWord.Keyword) against('keyword2') OR match(keyword) against('*keyword2' IN BOOLEAN MODE))
OR
(match(UrlKeyWord.Keyword) against('keyword3') OR match(keyword) against('*keyword3' IN BOOLEAN MODE))

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.