Jump to content

php error with games bank


Renlok

Recommended Posts

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]
Link to comment
https://forums.phpfreaks.com/topic/34059-php-error-with-games-bank/
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.