Jump to content
php.lv forumi
Sign in to follow this  
ziedinjsh

php idiorm, kā veikt +1 datubāzē

Recommended Posts

Sveiki, jau kādu brīdi meiģinu apdeitot datubāzi tā lai lietotājam pieskaitītu +1 pie punktiem, bet neizdodās.
Datubāzē tips norādīts kā INT.

Esmu izmeiģinājis visādīgi bet pirmajā reizē pievieno tikai 1 un vairāk neskaita klāt, kapēc tā?

$add_points = ORM::for_table('users')->find_one($me->id);
$add_points->set('points', '+1');
$add_points->save();

$add_points = ORM::for_table('users')->find_one($me->id);
$add_points->set('points', 'points +1');
$add_points->save();

$add_points = ORM::for_table('users')->find_one($me->id);
$add_points->set('points', 'points' +1);
$add_points->save();
Edited by ziedinjsh

Share this post


Link to post
Share on other sites

Paldies!
man izdevās arī šādi
 

$add_points = ORM::for_table('users')->find_one($me->id);
$add_points->points = $add_points->points+1;
$add_points->save();

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×