Renlok Posted January 13, 2007 Share Posted January 13, 2007 ive tryed to make a bank where users can withdraw and deposit there money within the game but i cant get the transactions to work, no idea what could be wrong they just dont work.[code] //userdata $username = $HTTP_COOKIE_VARS['mysite_username']; $query = "SELECT * FROM users WHERE md5='$username'"; $result = mysql_query($query); $row = mysql_fetch_array($result);$trans = $_POST['trans'];$amount = $_POST['amount'];$mult = $_POST['mult'];//getting username$username = $row['username'];//amount stored in bank for current user$bank = $row['bank'];//amount of points user has on hand$points = $row['points'];//getting bank rate$rate = $row['bankrate'];$ratequery = "SELECT * FROM bankrates WHERE id='$rate'";$raterun = mysql_query($ratequery);$raterow = mysql_fetch_array($raterun);$intrate = $raterow['value'];//getting interest values$dayrate = (($bank/100)*$intrate);$yearrate = $dayrate*365;if($trans == 'trans'){ if($bank < $amount) { echo "Thats not possible"; unset($_POST['trans']); } $amount = $amount*$mult; $newbank = $bank+$amount; $newpoints = $points-$amount; //updating users $banksql = "UPDATE users SET points='$newpoints' AND bank='$newbank' WHERE username='$username'"; $runtrans = mysql_query($banksql) or die("Error<br>".mysql_error()); echo "Processing"; unset($_POST['trans']); }[/code] Quote Link to comment https://forums.phpfreaks.com/topic/34059-php-error-with-games-bank/ Share on other sites More sharing options...
Philip Posted January 13, 2007 Share Posted January 13, 2007 if($trans == 'trans')Wouldn't the $trans be a number? Quote Link to comment https://forums.phpfreaks.com/topic/34059-php-error-with-games-bank/#findComment-160130 Share on other sites More sharing options...
tcollie Posted January 14, 2007 Share Posted January 14, 2007 Maybe this line....[code]$runtrans = mysql_query($banksql) or die("Error<br>".mysql_error());[/code]I could be wrong. Quote Link to comment https://forums.phpfreaks.com/topic/34059-php-error-with-games-bank/#findComment-160266 Share on other sites More sharing options...
corbin Posted January 14, 2007 Share Posted January 14, 2007 Try changing if($trans == 'trans') to if($trans) Quote Link to comment https://forums.phpfreaks.com/topic/34059-php-error-with-games-bank/#findComment-160268 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.