Ok.. using this
AND
$sth->execute($category) or die $DBI::errstr;
$categories = $category;
while (my $cat = ($sth->fetchrow_array)[0]) {
$categories .= ",$cat";
}
in search.cgi i was easily able to get links in certain categories by changing the search.cgi links query to
SELECT SUM(Weight) AS score, COUNT(*) AS hits, l.*, c.Name
FROM Links_Index AS s,
Links AS l,
Category AS c
WHERE $search_words
s.ID = l.ID AND
l.CategoryID = c.ID!;
$query .= qq! AND
CategoryID IN ($categories)! if ($categories);
$query .= qq!
GROUP BY s.ID
$having
$relevance
LIMIT $offset, 500
!;
now.. categories...
i will continue to try and rewrite the query.. but as i learned from the last time i did a multiple database query.. i suck!
anyways..
jerry
Code:
($in->param('category') =~ /^(\d+)$/) ? ($category = $1) : ($category = 0);AND
Code:
$sth = $db->prepare ( " SELECT SubCategoryID FROM CategoryHeiarchy WHERE CategoryID = ? "); $sth->execute($category) or die $DBI::errstr;
$categories = $category;
while (my $cat = ($sth->fetchrow_array)[0]) {
$categories .= ",$cat";
}
in search.cgi i was easily able to get links in certain categories by changing the search.cgi links query to
Code:
$query = qq! SELECT SUM(Weight) AS score, COUNT(*) AS hits, l.*, c.Name
FROM Links_Index AS s,
Links AS l,
Category AS c
WHERE $search_words
s.ID = l.ID AND
l.CategoryID = c.ID!;
$query .= qq! AND
CategoryID IN ($categories)! if ($categories);
$query .= qq!
GROUP BY s.ID
$having
$relevance
LIMIT $offset, 500
!;
now.. categories...
i will continue to try and rewrite the query.. but as i learned from the last time i did a multiple database query.. i suck!
anyways..
jerry