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

WBOY
Release: 2016-06-13 13:26:39
Original
847 people have browsed it

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>
Copy after login
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