Jump to content

I can't find an error...


ryeman98

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.