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"

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.