Thanks for the help of the PHPYII framework.

Source: Internet
Author: User
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),

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.