ryeman98 Posted August 4, 2007 Share Posted August 4, 2007 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 More sharing options...
ss32 Posted August 4, 2007 Share Posted August 4, 2007 check your WHERE statement... im pretty sure username is a reserve word and needs to be enclosed in back quotes also make sure that you called session_start (= Link to comment https://forums.phpfreaks.com/topic/63280-i-cant-find-an-error/#findComment-315402 Share on other sites More sharing options...
jitesh Posted August 4, 2007 Share Posted August 4, 2007 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 More sharing options...
ryeman98 Posted August 4, 2007 Author Share Posted August 4, 2007 check your WHERE statement... im pretty sure username is a reserve word and needs to be enclosed in back quotes also make sure that you called session_start (= Example? Link to comment https://forums.phpfreaks.com/topic/63280-i-cant-find-an-error/#findComment-315413 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.