想定义一下sql句中的catid
如果num=1 那么catid=5否则catid=7
不知这样的句子如何写呢
下面是sql句,
{pc:get sql="SELECT * from category where category.catid=$catid order by catid ASC" num="7" return="data"}
注意,我想写的这个句子要放在sql句子前的
加个if语句在前面判断可以吗?
if $num==1
{pc:get sql="SELECT * from category where category.catid=5 order by catid ASC" num="1" return="data"}
else
{pc:get sql="SELECT * from category where category.catid=$catid order by catid ASC" num="7" return="data"}