Home > Backend Development > PHP Tutorial > discuz中如何写操作数据库的句子

discuz中如何写操作数据库的句子

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

比如我想取portal_category这个表中所有字段的值
C::t('portal_category')->fetch........................ 后面怎么写呢?


回复讨论(解决方案)

C::t('portal_category')->fetch($id);//$id是主键
你可以到/source/class/table/目录下查看所有封装的表模型
你也可以用DB类操作数据库(表模型底层都是用的DB类操作的)
$res=DB::fetch_first('select * from %t where catid=%d',array('portal_category',1));

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