I put up a login system with a row called "credits" where I can give user credits and take them away. I need the code to be able to update the users credits using a form.
pointadd.php is where they use the form to add credits
<html> <body> <h2>Add Credits</h2> <form action="addcredit.php" method="post"> Give credits to: <input type="text" name="givegcreditnname"><br /> Amount of credits(negative to remove): <input type="text" name="addcredits"><br /> <input type="submit"><br /> </form> </body> </html>
addcredit.php is used to UPDATE the amount of credits they have.
<?php $give_credit_name = $_POST['givecreditnname']; $add_credits = $_POST['addcredits']; $dbc = mysqli_connect('...', '...', '...', '...') or die('Could not connect to Database'); $query = "UPDATE users WHERE username = '$give_credit_name' SET credits = '$add_credits'" . "VALUES('$add_credits')"; mysqli_query($dbc, $query) or die('Could not query'); mysqli_close($dbc); echo 'Points add or Subtracted.'; ?>
Each time I got on the page i get the "Could not Query".
Anyone know whats wrong, I am using php 5 and mysql 5.1 I believe.