コード例 #1
0
$whr = "admission<1 AND (rrule_pid=0 OR rrule_pid=id) ";
// カテゴリー指定
if ($cid > 0) {
    $cid4sql = sprintf("%05d,", $cid);
    $whr .= "AND categories like '%{$cid4sql}%'";
} else {
    if ($cid == -1) {
        $whr .= "AND categories=''";
    }
}
// フリーワード検索
if ($txt != "") {
    if (get_magic_quotes_gpc()) {
        $txt = stripslashes($txt);
    }
    $keywords = explode(" ", $cal->mb_convert_kana($txt, "s"));
    foreach ($keywords as $keyword) {
        $whr .= "AND (CONCAT( summary , description , location , contact ) LIKE '%" . addslashes($keyword) . "%') ";
    }
}
// クエリ
$rs = mysql_query("SELECT COUNT(id) FROM {$cal->table} WHERE {$whr}", $conn);
$numrows = mysql_result($rs, 0, 0);
$rs = mysql_query("SELECT * FROM {$cal->table} WHERE {$whr} ORDER BY start,end LIMIT {$pos},{$num}", $conn);
// ページ分割処理
include XOOPS_ROOT_PATH . '/class/pagenav.php';
$nav = new XoopsPageNav($numrows, $num, $pos, 'pos', "cid={$cid}&amp;tz={$tz}&amp;num={$num}&amp;txt=" . urlencode($txt));
$nav_html = $nav->renderNav(10);
if ($numrows <= 0) {
    $nav_num_info = _NONE;
} else {