SA-MP Forums Archive
Help with [PHP] & [mySQL] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with [PHP] & [mySQL] (/showthread.php?tid=166196)



Help with [PHP] & [mySQL] (FIXED, DELETE PLS) - DiddyBop - 07.08.2010

How do i withdrawl an amount, or value, From somones mysql account? Not resetting it, But checking if they have the amount first (I can do that), Then taking the amount required.

PHP код:

if($row[4] >= 60)
{
         echo 
'Ok you have enough...';
         
//Do mysql stuff here...
         
die;
}
if(
$row[4] <= 59)
{
         echo 
'You dont have enough!';
         
//Then the back button or redirect.
         
die;

But how would i go about Just taking the amount out, Like in pawn GivePlayerMoney(playerid, -500);

?!!?


Re: Help with [PHP] & [mySQL] - DiddyBop - 07.08.2010

Noone knowz?!


Re: Help with [PHP] & [mySQL] - ScottCFR - 07.08.2010

Код:
 $row -= or $row +=
edit :

pawn Код:
$row -= 500



Re: Help with [PHP] & [mySQL] - JaTochNietDan - 07.08.2010

Well a simple UPDATE query for subtraction is all you need since you know how to do the check.

pawn Код:
mysql_query('UPDATE `table` SET Money = Money - 500 WHERE ID = 50');



Re: Help with [PHP] & [mySQL] - DiddyBop - 07.08.2010

Thanks! will let yyou know if works..

EDIT: Ran into other problems... hold on plz.


Re: Help with [PHP] & [mySQL] - DiddyBop - 08.08.2010

Works! Thank you!