thinkPHP5.0 in setInc, setDec method

--- --- restore content begins

In thinkphp setInc, setDec method

It can be used for statistical fields (usually numeric field) updates, such as points, levels, and so the number of landing

Must be used with mating operation where coherence

1 $ User = M ( "User "); // instantiate a User object 
2 $ User-> where ( 'id = 5') -> setInc ( 'score', 3); // integral plus user 3 
3 $ user-> where ( 'id = 5 ') -> setInc ( 'score'); // add user points. 1 
. 4 $ user-> WHERE ( '= ID. 5') -> setDec ( 'Score',. 5) ; // Save user points. 5 
. 5 $ User-> WHERE ( '= ID. 5') -> setDec ( 'Score'); // Save user points 1


Previous message:

$front = Db::name('area')->where('id', '<', '4')->order('id desc')->limit('0,1')->find();

Next message:
$ Next name :: = Db ( 'Area') -> WHERE ( 'ID', '>', '. 5') -> Order ( 'ID ASC') -> limit ( '0,1' ) -> find ();

--- end --- restore content

Guess you like

Origin www.cnblogs.com/ymdphp/p/10941708.html