Jump to content

Recommended Posts

There are no mysql_error 's and everything works fine except for the points and the account_balance don't update...

 

if ($_GET['action'] == "deposit") {
	if (!$_POST['dep_point']) {
	echo "You need to enter a valid amount!";
	}
include("config.php");
$username = $_SESSION['username'];
$GetHandPoints = mysql_query("SELECT * FROM `users` WHERE username='$username'") or die(mysql_error());
$row_getpoints = mysql_fetch_array($GetHandPoints);
	if ($row_getpoints['points'] < $deposit_points) {
	echo "<b>Error!</b> You don't have that many points!";
	} else {
$depositpoints = $_POST['dep_point'];
	$update = mysql_query("UPDATE `users` SET points=(points-$depositpoints), account_balance=(account_balance+$depositpoints) WHERE username='$username'") or die(mysql_error());
	header('Location: /bank.php');
	}

Link to comment
https://forums.phpfreaks.com/topic/63280-i-cant-find-an-error/
Share on other sites

Try this

 

if(isset($_POST['dep_point']) and is_numeric($_POST['dep_point'])){
      $depositpoints = $_POST['dep_point'];
}else{
     $depositpoints = 0;

}

$sql = "UPDATE `users` SET points = points - ". $depositpoints ." , account_balance = account_balance + ".$depositpoints." WHERE username='".$username."'";

$update = mysql_query($sql) or die(mysql_error());			

Link to comment
https://forums.phpfreaks.com/topic/63280-i-cant-find-an-error/#findComment-315403
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.