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

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

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 ?

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

Archived

This topic is now archived and is closed to further replies.

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