:::

5-11 include/search.php

<?php
//搜尋程式
function snews_search($queryarray, $andor, $limit, $offset, $userid)
{
    global $xoopsDB;

    $sql = "SELECT `sn`,`title`,`update_time`, `uid` FROM " . $xoopsDB->prefix("snews") . " WHERE 1";
    if ($userid != 0) {
        $sql .= " AND uid=" . $userid . " ";
    }
    if (is_array($queryarray) && $count = count($queryarray)) {
        $sql .= " AND ((`title` LIKE '%{$queryarray[0]}%'  OR `content` LIKE '%{$queryarray[0]}%' )";
        for ($i = 1; $i < $count; $i++) {
            $sql .= " $andor ";
            $sql .= "(`title` LIKE '%{$queryarray[$i]}%' OR  `content` LIKE '%{$queryarray[$i]}%' )";
        }
        $sql .= ") ";
    }
    $sql .= "ORDER BY  `update_time` DESC";
    $result = $xoopsDB->query($sql, $limit, $offset);
    $ret    = array();
    $i      = 0;
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $ret[$i]['image'] = "images/icons/on.png";
        $ret[$i]['link']  = "index.php?sn=" . $myrow['sn'];
        $ret[$i]['title'] = $myrow['title'];
        $ret[$i]['time']  = strtotime($myrow['update_time']);
        $ret[$i]['uid']   = $myrow['uid'];
        $i++;
    }
    return $ret;
}

 


:::

搜尋

QR Code 區塊

https%3A%2F%2Ftad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1464%26tbsn%3D44

書籍目錄

展開 | 闔起

線上使用者

38人線上 (13人在瀏覽線上書籍)

會員: 0

訪客: 38

更多…