', menuitems_groups.menuitems_groups_title_1) AS cat, 'menuitems' AS type FROM menuitems INNER JOIN menu ON (menuitems.IDmenu=menu.IDmenu) LEFT JOIN menuitems_groups ON (menuitems.IDmenuitems_groups=menuitems_groups.IDmenuitems_groups) WHERE IDmenuitems_link = NULL AND menuitems_active = 1 AND (menuitems_title_1 LIKE %s OR menuitems_content_1 LIKE %s))
UNION
(SELECT IDnews AS id, news_title_1 AS title, 'Novità ed Eventi' AS cat, 'news' AS type FROM news WHERE news_active = 1 AND (news_title_1 LIKE %s OR news_content_1 LIKE %s))
UNION
(SELECT IDnotizie AS id, notizie_titolo_1 AS title, notizie_cat.notizie_cat_title_1 AS cat, 'notizie' AS type FROM notizie INNER JOIN notizie_cat ON (notizie.IDnotizie_cat=notizie_cat.IDnotizie_cat) WHERE notizie_attivo = 1 AND (notizie_titolo_1 LIKE %s OR notizie_content_1 LIKE %s))
ORDER BY id DESC
", GetSQLValueString("%".$colname_RsSearchResults."%", "text"), GetSQLValueString("%".$colname_RsSearchResults."%", "text"), GetSQLValueString("%".$colname_RsSearchResults."%", "text"), GetSQLValueString("%".$colname_RsSearchResults."%", "text"), GetSQLValueString("%".$colname_RsSearchResults."%", "text"), GetSQLValueString("%".$colname_RsSearchResults."%", "text"));
$query_RsSearchResults = lang_fields_switch($query_RsSearchResults);
$query_limit_RsSearchResults = sprintf("%s LIMIT %d, %d", $query_RsSearchResults, $startRow_RsSearchResults, $maxRows_RsSearchResults);
$RsSearchResults = mysql_query($query_limit_RsSearchResults, $mydb) or die(mysql_error());
$row_RsSearchResults = mysql_fetch_assoc($RsSearchResults);
if (isset($_GET['totalRows_RsSearchResults'])) {
$totalRows_RsSearchResults = $_GET['totalRows_RsSearchResults'];
} else {
$all_RsSearchResults = mysql_query($query_RsSearchResults);
$totalRows_RsSearchResults = mysql_num_rows($all_RsSearchResults);
}
$totalPages_RsSearchResults = ceil($totalRows_RsSearchResults/$maxRows_RsSearchResults)-1;
$queryString_RsSearchResults = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_RsSearchResults") == false &&
stristr($param, "totalRows_RsSearchResults") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_RsSearchResults = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_RsSearchResults = sprintf("&totalRows_RsSearchResults=%d%s", $totalRows_RsSearchResults, $queryString_RsSearchResults);
?>