Jump to content

Internet Game - Transfering Help


spike_132000

Recommended Posts

Hey There, I have this code. it is for my internet game - [a href=\"http://undergroundwarz.samwillis.net\" target=\"_blank\"]http://undergroundwarz.samwillis.net[/a]. I am having problems when i try to use it, what it is supposed to do is, take money from one persons's bank and put it into another, like transfering money between two accounts! Here is the code for "bank4.php"

[code]
<?
include 'connect.php';
session_start();
?>
<link rel="stylesheet" href="style.css">
<?
if (isset($_SESSION['player']))
{

$player=$_SESSION['player'];

$ide=$_POST['id'];
$userstats="SELECT * from km_users where playername='$player'";
$userstats2=mysql_query($userstats) or die("Could not get user stats");
$userstats3=mysql_fetch_array($userstats2);
$tuserstats="SELECT * from km_users where ID='ide'";
$tuserstats2=mysql_query($tuserstats) or die("Could not get other players stats");
$tuserstats3=mysql_fetch_array($tuserstats2);
$gold1=$_POST['gold'];
if ($userstats3[bank]>$gold)
{
$updatebanks="update km_users set gold=gold-'$gold1' where playername='$player'";
$updateother="update km_users set gold=gold+'$gold1' where ID='$ide'";
mysql_query($updatebanks) or die("Could not Update You");
mysql_query($updateother) or die("Could not Update Player");
print "<center>Successfully Transfered $gold gold to $ide.<br>Click <a href='index.php'>here</a> to return";
}
else if ($userstats3[bank]<$gold)
{
print "<center>You do not have that amount of gold to Transfer";
}
else if ($gold=='-')
{
print "<center>You cannot transfer negative amounts";
}
}
else
{
print "<center>You are not logged in"; die();
}
?>
[/code]

Would Someone be able to tell me where I am going wrong... Here is the code from "bank.php" that sends the data to "bank4.php"

[code]
print "<form action='bank4.php' method='post'>ID to Send To: <input type='text' name='id'> Amount to Send: <input type='text' name='id'><input type='submit' value='Transfer Cash'></form>";
[/code]

Thank You in Advance!
Link to comment
Share on other sites

for starters before i even look at the rest of your code,
[code]
print "<form action='bank4.php' method='post'>ID to Send To: <input type='text' name='id'> Amount to Send: <input type='text' name='id'><input type='submit' value='Transfer Cash'></form>";
[/code]
both your input tags have the same name.
Link to comment
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.