xwishmasterx Posted April 25, 2011 Share Posted April 25, 2011 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" Quote Link to comment https://forums.phpfreaks.com/topic/234697-so-what-is-wrong-with-this-code-process-after-simple-form/ Share on other sites More sharing options...
fugix Posted April 25, 2011 Share Posted April 25, 2011 what is the value of $numrows? Quote Link to comment https://forums.phpfreaks.com/topic/234697-so-what-is-wrong-with-this-code-process-after-simple-form/#findComment-1206066 Share on other sites More sharing options...
xwishmasterx Posted April 25, 2011 Author Share Posted April 25, 2011 I'm a php illiterate, what do you mean value? Or better how do I check, can I do a simple echo? Quote Link to comment https://forums.phpfreaks.com/topic/234697-so-what-is-wrong-with-this-code-process-after-simple-form/#findComment-1206071 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.