Thanks for the help of the PHPYII framework. The MODEL layer code is as follows: publicfunctionrules () {// NOTE: youshouldonlydefinerulesforthoseattributesthat/willreceiveuserin php yii Framework. thank you!
First look at the code.
The MODEL layer code is as follows:
Public function rules ()
{
// NOTE: you shocould only define rules for those attributes that
// Will receive user inputs.
Return array (
Array ('keyid', 'numerical '),
Array ('studyid', 'length', 'Max' => 30 ),
Array ('mayn, m1_d51, m1_d52, m1_d6, m1_c1 ')
Array ('m0000b4, m0000c5 ', 'length', 'Max' => 100 ),
Array ('m1_d10, m1_d11', 'length', 'Max '=> 2 ),
Array ('keyid, STUDYID, SUBJID, SITEID, SUBJINIT, RANDNO, VISIT, VISITNUM, CRFPAGE, SEQNO, ENTRYNO, KEY1, KEY2, KEY3, delimiter, m1_d51, m1_d52, m1_d6, m1_c1 ')
);
}
Public function search ()
{
// Warning: Please modify the following code to remove attributes that
// Shocould 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 ('mshortayn', $ this-> mshortayn, true );
$ Criteria-> compare ('m0000d51', $ this-> m0000d51, true );
$ Criteria-> compare ('m1_d52', $ this-> m1_d52, true );
$ Criteria-> compare ('m0000d6 ', $ this-> m0000d6, true );
$ Criteria-> compare ('m1_d7', $ this-> m1_c1, true );
Return new CActiveDataProvider (get_class ($ this), array (
'Criteria '=> $ criteria,
));
}
How can I display "undefined" when using m1_c1 ?" Master busy
------ Solution --------------------
Fewer ,?
------ Solution --------------------
Not familiar with YII, but from the code perspective
$ Criteria-> compare ('m0000d6 ', $ this-> m0000d6, true );
Is to match the result returned by rules with the object property
So
$ Criteria-> compare ('m1_d7', $ this-> m1_c1, true );
M1_d7 is not in the result returned by rules
------ Solution --------------------
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),