$v){ $arr[$k]=addslashes($v); } $queryarray=$arr; } $sql = "SELECT `page_sn`,`page_title`,`page_post_time`, `uid` FROM ".$xoopsDB->prefix("tad_ebook_page")." WHERE 1"; if ( $userid != 0 ) { $sql .= " AND uid=".$userid." "; } if ( is_array($queryarray) && $count = count($queryarray) ) { $sql .= " AND ((`page_title` LIKE '%{$queryarray[0]}%' OR `page_content` LIKE '%{$queryarray[0]}%' OR `page_author` LIKE '%{$queryarray[0]}%' OR `page_tag` LIKE '%{$queryarray[0]}%')"; for($i=1;$i<$count;$i++){ $sql .= " $andor "; $sql .= "(`page_title` LIKE '%{$queryarray[$i]}%' OR `page_content` LIKE '%{$queryarray[$i]}%' OR `page_author` LIKE '%{$queryarray[$i]}%' OR `page_tag` LIKE '%{$queryarray[$i]}%')"; } $sql .= ") "; } $sql .= "ORDER BY `page_post_time` DESC"; $result = $xoopsDB->query($sql,$limit,$offset); $ret = array(); $i = 0; while($myrow = $xoopsDB->fetchArray($result)){ $ret[$i]['image'] = "images/search.png"; $ret[$i]['link'] = "index.php?page_sn=".$myrow['page_sn']; $ret[$i]['title'] = $myrow['page_title']; $ret[$i]['time'] = strtotime($myrow['page_post_time']); $ret[$i]['uid'] = $myrow['uid']; $i++; } return $ret; } ?> ```
進階搜尋
584人線上 (225人在瀏覽線上書籍)
會員: 0
訪客: 584