HarleyJ Posted July 22, 2007 Share Posted July 22, 2007 Hey guys, Im looking to create a banking system for my game. However I know very little about php. http://www.flashmoron.com/valhallen is the game I wish to create a points system for. I know how it should work But I have little clue of all the coding mumbo jumbo. Get points from Database > If the amount of points held is less than what they are trying to deposit > Error message > Else if Amount of points held is more than they tried to deposit > Subtract Points from Database > Update bank database. Thats basicly how it works I think, If anyone would be willing to tutor me, I would be very greatful. Panaramaa@Hotmail.com Quote Link to comment Share on other sites More sharing options...
jd2007 Posted July 22, 2007 Share Posted July 22, 2007 i'll help u, i'll e-mail u. Quote Link to comment Share on other sites More sharing options...
Barand Posted July 22, 2007 Share Posted July 22, 2007 it would go something like this <?php // assume we're starting with these values $deposit_amt = 500; $userid = 'harleyj'; $sql = "SELECT points FROM banktable WHERE userid = '$userid' "; // create the query $res = mysql_query ($sql) or die(mysql_error()); // execute the query, checking for errors $points_held = mysql_result ($res, 0,0); // extract the points from the query results // now check the values if ($deposit_amt > $points_held) { echo "Sorry, insufficient points in bank"; } else { $sql = "UPDATE banktable SET points = points - $deposit_amt WHERE userid = '$userid' "; // create update query mysql_query ($sql) or die(mysql_error()); // execute echo "Deposit accepted and your points adjusted"; } ?> BTW, are you sure you mean "deposit" and not "withdrawal"? Quote Link to comment 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.