Propel icon indicating copy to clipboard operation
Propel copied to clipboard

update column between two same query request

Open MissMyCat opened this issue 8 years ago • 0 comments

I query the user at first (user.age = 18) $user = AdaptUserAchievementQuery::create()->findOneByUserId($user_id); then I changed some value ($number =1 ) $sql = sprintf('UPDATE DBname SET age= age+ %u WHERE user_id = %u ', $number, $user->getUserId()); $this->con =Propel::getWriteConnection(DATABASE_NAME); $this->con->query($sql); then I query the user again $new_user = AdaptUserAchievementQuery::create()->findOneByUserId($user_id);

well, when I print the user age and new user age both is 18, but I check the record in DB, the age has changed to 19.

the question is how can I get the new user age is 19 rather than 18?

MissMyCat avatar Sep 14 '16 07:09 MissMyCat