phpcms里执行一句SQL语句,请问正式格式是什么?
我写的是,,<?phpeval("\$count=(SELECTCOUNT(catid)FROM`v9_category`WHEREparentid=$r[catid])...
我写的是,,
<?php
eval("\$count =(SELECT COUNT( catid ) FROM `v9_category` WHERE parentid =$r[catid])(0);");
?>
但是肯定不对,,求教正确格式,,谢谢,, 展开
<?php
eval("\$count =(SELECT COUNT( catid ) FROM `v9_category` WHERE parentid =$r[catid])(0);");
?>
但是肯定不对,,求教正确格式,,谢谢,, 展开
1个回答
展开全部
文章范围为59 60 61三个栏目,并且推送到了27 和28两个推荐位;
从第三条开始,连续调用7篇文章。
{pc:get sql="SELECT * FROM v9_news WHERE id IN (SELECT id FROM v9_position_data WHERE posid in(27,28) and catid in(59,60,61)) order by listorder DESC" cache="3600" start="3" num="7" return="data" }
{loop $data $n $r}
<li>·<a target="_blank" href='{$r[url]}' title="{$r[title]}" style="color:Black;">{str_cut($r[title],22,'')}</a></li>
{/loop}
{/pc}
从第三条开始,连续调用7篇文章。
{pc:get sql="SELECT * FROM v9_news WHERE id IN (SELECT id FROM v9_position_data WHERE posid in(27,28) and catid in(59,60,61)) order by listorder DESC" cache="3600" start="3" num="7" return="data" }
{loop $data $n $r}
<li>·<a target="_blank" href='{$r[url]}' title="{$r[title]}" style="color:Black;">{str_cut($r[title],22,'')}</a></li>
{/loop}
{/pc}
更多追问追答
追问
,,,,你确认你没有回答错?
追答
我就是给你写了个大概样子
{pc:get sql=" sql语句 "}
{loop $data $n $r}
循环
{/loop}
{/pc}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询