1Next >
pktsandy | 发表于:11-11-07 12:57 编辑于:11-07 12:59 [添加收藏] 楼主 [回复] #Top# |
---|---|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
例如以下SQL:
select * from ( select listid,kid from kcest.king__article where nshow=1 and ktag like '%ni ma%' order by ndate desc ) as tmp_article UNION ALL select * from ( select listid,kid from %s__product where nshow=1 and ktag like '%ni ma%' order by ndate desc ) as tmp_product UNION ALL select * from ( select listid,kid from %s__shop where nshow=1 and ktag like '%ni ma%' order by ndate desc ) as tmp_shop UNION ALL select * from ( select listid,kid from %s__bbs where nshow=1 and ktag like '%ni ma%' order by ndate desc ) as tmp_bbs limit 0,10
private function filterTablePrefix( $sql ){
if (! strpos ( $sql , 'like' )) return $sql ;
preg_match( '/(%w+%)/' , $sql , $word );
$s_ = str_replace ( $word [1], '#word' , $sql );
$s =preg_replace( '/(%s_)(w+)/' ,DB_PREFIX. '_$2' , $s_ );
$sql = str_replace ( '#word' , $word [1], $s );
return $sql ;
}
$this ->link==0 && $this ->connect(); //判断数据库连接是否可用
$_str = $this ->filterTablePrefix( $_str );
{king:portal type="tag" modelid="1" number="10" orderby="ndate desc"}
< p >< strong >< a href = "{king:path/}" >{king:title/}</ a ></ strong ></ p >
{/king:portal}
Ta最近还发表过
[分享]
MYSQL5.5的中文手册
(19-03-22)
[分享]
留言的修改版
(18-02-26)
[分享]
KC PHP源代码剖析(慢慢补充)
(16-02-18)
[使用]
新闻内容页的分页
(14-08-24)
[使用]
货栈评论JS动态翻页
(13-11-08)
随机阅读
[分享]
[德阳123]地方门户版实现论坛帖子定位教程
(17-04-24)
[错误]
KC BLUE 蓝色模板下 分类信息里面 都点不进去了
(14-09-05)
[模板]
模板放上来了,小的BUG大家自己来修正吧。
(14-05-05)
[建议]
企业版IIS伪静态如何怎么写?
(13-04-12)
[使用]
不错!简单
(11-04-14)
|
1Next >