I just made this code for money, if you have 2 units of money, like dollars and cents, gold and silver, etc, on your site. In this script there is 10 unit 2 in unit 1. I would appreciate any comments/suggestions/etc. also I need help with the last bit
<?php
function moneycvt("$unita","$unitb") {
return ($unita * 10) + $unitb;
}
function moneyback("$unit") {
$unitb = $unit % 10;
$newunit = $unit - $unitb;
$unita = $newunit / $unit;
return array($unita,$unitb);
}
?>
and then you can use it to do things like check to see if you have enough money for stores, etc. for example:
<?php
include "whateverthefileaboveis.php";
$yourmoney = moneycvt("$variableforpersonunit1","$variableforpersonunit2");
$storemoney = moneycvt("$variableforstoreunit1","$variableforstoreunit2");
if ($storemoney > $yourmoney) { echo "you dont have enough money"; }
else{
$newmoney = $yourmoney - $storemoney;
$back = moneyback("$newmoney");
mysql_query("UPDATE membertable SET unit1='$whatdoiputhere',unit2='$whatdoiputhere2'");
}
?>
ok, so what I need help with is what variable should i put in the last 2, $whatdoiputhere and $whatdoiputhere2?