Jump to content

So what is wrong with this code? (process after simple form)


xwishmasterx

Recommended Posts

I am not getting the result I am hoping for. The code below is full code after a form has been submitted containing a member name and amount of credits:

 

<?php
if (isset($t)){
$t = $_GET['t'];}
?>
<?php
$amount = $_POST['amount'];
$member = $_POST['member'];

$sql = ("SELECT vtp_members.name, vtp_members.team_id FROM vtp_members WHERE vtp_members.team_id=".$_GET['t']." AND vtp_members.name='$member' AND teams.team_treasure >= '$amount' ");
$result = mysql_query($sql);
$numrows = mysql_num_rows($result);
if($numrows == '1')
{
  $sql2 = "UPDATE vtp_members, teams SET vtp_members.hits=(vtp_members.hits + '$amount'), teams.team_treasure=(teams.team_treasure - '$amount')
WHERE vtp_members.name='$member' AND teams.team_id=".$_GET['t']." ";
$results2 = mysql_query($sql2);
$row2 = mysql_fetch_row($results2);
$tmap2 = $row2[0];

echo "You sent ". $amount . "credits to " . $member . ". ";
}
else
{
echo "The treasure holdings are too low for this transfer<br>(or an error occured)";}

?>

 

Problem; it returns the else statement although the "teams.team_treasure" is higher or equal to  "$amount"

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.