Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update column between two same query request #1037

Open
MissMyCat opened this issue Sep 14, 2016 · 0 comments
Open

update column between two same query request #1037

MissMyCat opened this issue Sep 14, 2016 · 0 comments

Comments

@MissMyCat
Copy link

MissMyCat commented Sep 14, 2016

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 MissMyCat changed the title update column between two same query request (test remain) Sep 14, 2016
@MissMyCat MissMyCat changed the title (test remain) update column between two same query request Sep 14, 2016
@MissMyCat MissMyCat reopened this Sep 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant