PHP代码修改问题,调用上下篇

yaohaijin 发布于 2016/06/08 13:21
阅读 120
收藏 0
PHP
/** one website */
function get_one_website($where = 1) {
	global $DB;
	
	$row = $DB->fetch_one("SELECT w.user_id, w.cate_id, w.web_id, w.web_name, w.web_url, w.web_tags, w.web_pic, w.web_intro, w.web_ispay, w.web_istop, w.web_isbest, w.web_status, w.web_ctime, d.web_ip, d.web_grank, d.web_brank, d.web_srank, d.web_arank, d.web_instat, d.web_outstat, d.web_views, d.web_utime FROM ".$DB->table('websites')." w LEFT JOIN ".$DB->table("webdata")." d ON w.web_id=d.web_id WHERE $where LIMIT 1");
	
	return $row;
}
	
/** prev website */
function get_prev_website($aid = 0) {
	global $DB;
	
	$row = $DB->fetch_one("SELECT web_id, web_title FROM ".$DB->table('websites')." WHERE web_status=3 AND web_id < $aid ORDER BY web_id DESC LIMIT 1");
	if (!empty($row)) {
		$row['web_link'] = get_website_url($row['web_id']);
	}
	
	return $row;
}

/** next website */
function get_next_website($aid = 0) {
	global $DB;
	
	$row = $DB->fetch_one("SELECT web_id, web_title FROM ".$DB->table('websites')." WHERE web_status=3 AND web_id > $aid ORDER BY web_id ASC LIMIT 1");
	if (!empty($row)) {
		$row['web_link'] = get_website_url($row['web_id']);
	}
	
	return $row;
}

<li>上一篇: {#if !empty($prev)#}<a href="{#$prev.web_link#}">{#$prev.web_title#}</a>{#else#}没有了{#/if#}</li>
<li>下一篇: {#if !empty($next)#}<a href="{#$next.web_link#}">{#$next.web_title#}</a>{#else#}没有了{#/if#}</li>

  为什么会不线索的。



加载中
返回顶部
顶部