phpcms这样的句子如何写

WBOY
Release: 2016-06-23 13:42:23
Original
963 people have browsed it

想定义一下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"}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!