:::

13-1 include/search.php

<?php
function tad_contact_search($queryarray, $andor, $limit, $offset, $userid){
    global $xoopsDB;
    //處理許功蓋
    if(get_magic_quotes_gpc()){
        foreach($queryarray as $k=>$v){
            $arr[$k]=addslashes($v);
        }
        $queryarray=$arr;
    }
    $sql = "SELECT sn,name,post_date, uid FROM ".$xoopsDB->prefix("contact")." WHERE 1";
    if ( $userid != 0 ) {
        $sql .= " AND uid=".$userid." ";
    }
    if ( is_array($queryarray) && $count = count($queryarray) ) {
        $sql .= " AND ((name LIKE '%{$queryarray[0]}%' OR company LIKE '%{$queryarray[0]}%' OR note LIKE '%{$queryarray[0]}%')";
        for($i=1;$i<$count;$i++){
            $sql .= " $andor ";
            $sql .= "( name LIKE '%{$queryarray[$i]}%' OR company LIKE '%{$queryarray[$i]}%' OR note LIKE '%{$queryarray[$i]}%')";
        }
        $sql .= ") ";
    }
    $sql .= "ORDER BY name DESC";
    $result = $xoopsDB->query($sql,$limit,$offset);
    $ret = array();
    $i = 0;
     while($myrow = $xoopsDB->fetchArray($result)){
        $ret[$i]['image'] = "images/arrow.gif";
        $ret[$i]['link'] = "index.php?op=show&sn=".$myrow['sn'];
        $ret[$i]['title'] = $myrow['name'];
        $ret[$i]['time'] = strtotime($myrow['post_date']) ;
        $ret[$i]['uid'] = $myrow['uid'];
        $i++;
    }
    return $ret;
}
?>


:::

搜尋

QR Code 區塊

https%3A%2F%2Fwww.tad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D5%26tbdsn%3D110

書籍目錄

展開 | 闔起

線上使用者

29人線上 (2人在瀏覽線上書籍)

會員: 0

訪客: 29

更多…