Well I am completely new to php.
I have this script I have been working on for a few days now everything is working except the 2 update statements. I am sure that my script is pretty sloppy as well I apologize for that but as I have stated before I am quite new to this. Any ways the purpose of this script is to take money from one player and give to another. It is not based in sessions yes I know that's not good practice I am in the process of changing that now. Here's the script hope someone can be of some help. Thanks.
$choice=strip_tags($_POST['choice']);
if ($choice==2){
//getting the random player
$sql = mysql_query ("SELECT * FROM `users` ORDER BY RAND() LIMIT 0,1") or die (mysql_error ());
$res = mysql_fetch_assoc ($sql);
$randplayer = $res['username'];
$geld =$res['geld'];
//taking money from the random player
$percent = rand(10,25);
$takenGeld = round($geld * ($percent / 100));
$picker =mysql_query("SELECT geld FROM users WHERE username=$cookieusername");
$test=round($geld / $percent);
$test1=$geld-$takenGled;
$test2=$picker+$takenGeld;
mysql_query("UPDATE `users` SET `geld`='$test1' WHERE `username`='$randplayer'");
mysql_query("UPDATE `users` SET `geld`='$test2' WHERE `username`='$cookieusername'");
}
echo"You took $takenGeld from $randplayer
This is a test amout left $test1 and amout took $test2'";
?>