mysql prepared statements with special operators (addition, subtraction etc.)?
Would this scenario work:
$query = ' UPDATE users SET balance = (balance + ?) WHERE user = ? ';
$sth = $dbh->prepare($query);
$sth->execute(array($rechargeamount, $username));
basically, a prepared statement for an amount followed by an addition operator. Or would prepared statement have to include the "balance" value as well?
开发者_JAVA百科many thanks!
Will work. Make sure you prepare out as an int (depends on which sql engine you're using)
精彩评论