0

How do I add a PHP variable's value to a value in my database? I'm forced to use PDO, so this is what I have so far and it works just fine to add 20 to reputation;

$rep = $conn->prepare("UPDATE `users` SET `reputation` = `reputation` + 20 WHERE `email` = :email");
$rep->bindParam(":email", $_SESSION['email']);
$rep->execute();

Now, I wan't to add a variable called $repbonus to reputation, so I tried this:

$rep = $conn->prepare("UPDATE `users` SET `reputation` = `reputation` + :rep WHERE `email` = :email");
$rep->bindParam(":email", $_SESSION['email']);
$rep->bindParam(":rep", $repbonus);
$rep->execute();

It doesn't work though, any pointers?

NodziGames
  • 395
  • 3
  • 17

1 Answers1

0

My apologies, it seems I made a typo at first by saying bindParma instead of bindParam.

NodziGames
  • 395
  • 3
  • 17