Jump to content

Banking System,


HarleyJ

Recommended Posts

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

Link to comment
Share on other sites

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"?

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.