Home > Backend Development > PHP Tutorial > Yii关于数据获取的有关问题

Yii关于数据获取的有关问题

WBOY
Release: 2016-06-13 13:16:10
Original
799 people have browsed it

Yii关于数据获取的问题
$res = Yii::app()->db->createCommand()
  ->select('uid,uname,ucreatetime,utelephone,umobile')
  ->from('yc_userinfo')
  ->where('uroleid=3 or uroleid=4')
  ->queryAll();
请问 where('uroleid=3 or uroleid=4') 这段 用AR时候 params 怎么指定啊?

------解决方案--------------------
params是与condition一一对应的你condition=>'uroleid=:uroleid',params=>array(':uroleid'=>3);这样就行了

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