:::

5-3 include/search.php

<?php
//搜尋程式

function tad_signup_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 `action_id`,`title`,`action_date`, `uid` FROM ".$xoopsDB->prefix("actions")." WHERE `enable`=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  `action_date` 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?action_id=".$myrow['action_id'];
		$ret[$i]['title'] = $myrow['title'];
		$ret[$i]['time'] = strtotime($myrow['action_date']);
		$ret[$i]['uid'] = $myrow['uid'];
		$i++;
	}
	return $ret;
}

 


:::

書籍目錄

展開 | 闔起

http%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D31%26tbdsn%3D927

計數器

今天: 1996199619961996
昨天: 2300230023002300
總計: 7582650758265075826507582650758265075826507582650