After reading the tutorial, I have an example of activereocord, but there are too few instances. I just want to find a few more examples by myself. would you like to ask, is this simple or standard? It is to find the data named Huang Moumou, and then add the Chinese score + 1 {code ...} after reading the tutorial, I have an example of activereocord, but there are too few instances. I just want to find a few more examples by myself. would you like to ask, is this simple or standard?
The data called Huang Moumou is searched, and then the Chinese score is + 1
Public function activereocord2 () {$ use = D ('classone'); $ id = $ use-> getByname ('Huang mou') ['id']; $ condition ['id'] = $ id; $ use-> where ($ condition)-> setInc ('China', 1 ); $ this-> oneRow ($ id );}
Reply content:
After reading the tutorial, I have an example of activereocord, but there are too few instances. I just want to find a few more examples by myself. would you like to ask, is this simple or standard?
The data called Huang Moumou is searched, and then the Chinese score is + 1
Public function activereocord2 () {$ use = D ('classone'); $ id = $ use-> getByname ('Huang mou') ['id']; $ condition ['id'] = $ id; $ use-> where ($ condition)-> setInc ('China', 1 ); $ this-> oneRow ($ id );}
$ Use = D ('classone'); $ use-> where (array ('name' => 'yellow XX ')-> setInc ('China', 1 );
Read the manual carefully
Isn't it a result set after get by name? why should I check it again...
The ID is obtained by name, and the ID field is used to modify the field...
Didn't you go around...
It can be done in just one sentence, so we have to avoid so many detours. Write down the SQL statement before using the model syntax.