Propel
Propel copied to clipboard
update column between two same query request
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?