首页 > 后端开发 > php教程 > PHP YII框架的来帮忙了,多谢了

PHP YII框架的来帮忙了,多谢了

WBOY
发布: 2016-06-13 10:29:04
原创
880 人浏览过

PHP YII框架的来帮忙了,谢谢了
先看代码。
MODEL层代码如下:
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('KEYID', 'numerical'),
array('STUDYID', 'length', 'max'=>30),
array('MH7AYN, MH7D51, MH7D52, MH7D6, MH7C1')
  array('MH7B4, MH7C5', 'length', 'max'=>100),
array('MH7D10, MH7D11','length','max'=>2),
  array('KEYID, STUDYID, SUBJID, SITEID, SUBJINIT, RANDNO, VISIT, VISITNUM, CRFPAGE, SEQNO, ENTRYNO, KEY1, KEY2, KEY3, MH7AYN, MH7D51, MH7D52, MH7D6, MH7C1')
  );
}

public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.

$criteria=new CDbCriteria;

$criteria->compare('KEYID',$this->KEYID);
$criteria->compare('STUDYID',$this->STUDYID,true);
$criteria->compare('SUBJID',$this->SUBJID,true);
$criteria->compare('SITEID',$this->SITEID,true);
$criteria->compare('SUBJINIT',$this->SUBJINIT,true);
$criteria->compare('RANDNO',$this->RANDNO,true);
$criteria->compare('VISIT',$this->VISIT,true);
$criteria->compare('VISITNUM',$this->VISITNUM,true);
$criteria->compare('CRFPAGE',$this->CRFPAGE,true);
$criteria->compare('SEQNO',$this->SEQNO);
$criteria->compare('ENTRYNO',$this->ENTRYNO);
$criteria->compare('KEY1',$this->KEY1,true);
$criteria->compare('KEY2',$this->KEY2,true);
$criteria->compare('KEY3',$this->KEY3,true);
$criteria->compare('MH7AYN',$this->MH7AYN,true);
$criteria->compare('MH7D51',$this->MH7D51,true);
$criteria->compare('MH7D52',$this->MH7D52,true);
$criteria->compare('MH7D6',$this->MH7D6,true);
$criteria->compare('MH7D7',$this->MH7C1,true);
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
));
}
在用MH7C1的时候怎么显示 “未定义呀?”高手忙

------解决方案--------------------
少个 , ?
------解决方案--------------------
不了解 YII,不过从代码上看
$criteria->compare('MH7D6',$this->MH7D6,true);
是将 rules 返回的结果与对象的属性对应起来
那么
$criteria->compare('MH7D7',$this->MH7C1,true);
中 MH7D7 并不在 rules 返回的结果中

------解决方案--------------------

PHP code
array('STUDYID', 'length', 'max'=>30),array('MH7AYN, MH7D51, MH7D52, MH7D6, MH7C1')  array('MH7B4, MH7C5', 'length', 'max'=>100),array('MH7D10, MH7D11','length','max'=>2),<div class="clear">
                 
              
              
        
            </div>
登录后复制
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板