OK hey guys. It's me again. I have a problem with my mysql search queries. Now I am doing this on my own with no outside helo other than a crappy book I'm reading. Now I know that I can do fulltext searching but I was wiondering if there was another way to get results from my tables. Also is there a limit on how long your query should be. I'll post the queries below for reference.
here is the main query that get's generated by my script depending on form input.
Now it doesn't look complicated nor does it lok liek it gets much done but it works for some words that I search for. BTW I have 3 tables with fulltext indexes on all of them so then next query uses those indexes.
and here is the wrray that I use to create the search locations.
here is the main query that get's generated by my script depending on form input.
Code:
$query = "SELECT * FROM $table WHERE MATCH($extra) AGAINST('*$str_what*')";
Now it doesn't look complicated nor does it lok liek it gets much done but it works for some words that I search for. BTW I have 3 tables with fulltext indexes on all of them so then next query uses those indexes.
Code:
$query = "(SELECT DISTINCTROW * FROM $table[0],$table[1],$table[2] WHERE
MATCH($extra0) AGAINST('+(*(($str_what)(*))))' IN BOOLEAN MODE))
UNION (SELECT DISTINCTROW * FROM $table[0],$table[1],$table[2] WHERE
MATCH($extra1) AGAINST('+(*(($str_what)(*))))' IN BOOLEAN MODE))
UNION (SELECT DISTINCTROW * FROM $table[0],$table[1],$table[2] WHERE
MATCH($extra2) AGAINST('+(*(($str_what)(*))))' IN BOOLEAN MODE))";
and here is the wrray that I use to create the search locations.
Code:
$table = array($files_table, $main_table, $links_table);
$extra0 = $table[0].'.'.path.','.$table[0].'.'.added.','.$table[0].'.'.edited.
','.$table[0].'.'.type.','.$table[0].'.'.description;
$extra1=$table[1].'.'.message.','.$table[1].'.'.created.','.$table[1].'.'.edited.
','.$table[1].'.'.author;
$extra2=$table[2].'.'.name.','.$table[2].'.'.category.
','.$table[2].'.'.created.','.$table[2].'.'.url.
','.$table[2].'.'.description;