Forum Moderators: coopster
Here is my code
##If Weapon Cost is Less then Users Gold Purchase OK
if ($_POST['cost'] <= $ucrow['gold'])
{
$gold = $ucrow['gold'] - $_POST['cost'];
$wiresult = mysql_query("INSERT INTO purchased (username, item_type, resell, item_name, damage, type) VALUES ('$username', '$type', '$resell', '$name', '$defense', '$wtype')", $link);
##If Insert is successful return TRUE
if ($wiresult == TRUE)
{
$ucupdate = mysql_query("UPDATE user_char SET gold = '$gold' where username = '$username'", $link);
echo 'Purchase Successful you have '.$gold.' gold remaining.<br><br>';
}
##Else Purchase Failed
else
{
echo 'You do not have enough gold to purchase this item.<br><br>';
}
##End first if statement
}
##Else Negative
else
{
echo 'You do not have enough gold to purchase this item.<br><br>';
}
}