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?
many thanks!
Will work. Make sure you prepare out as an int (depends on which sql engine you’re using)