:::

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;
}

 


:::

書籍目錄

展開 | 闔起

快速登入


https%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D927%26tbsn%3D31

計數器

今天: 4541454145414541
昨天: 2489248924892489
總計: 8026523802652380265238026523802652380265238026523