SA-MP Forums Archive
MySQL Problem - 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)
+--- Thread: MySQL Problem (/showthread.php?tid=540222)



MySQL Problem - EmilLykke - 03.10.2014

I got this issue, that it doesn't work.

It should give the user the 100 dollars, but it doesn't... And yeah, it's when he is offline...

Can anybody tell me why it doesn't work?

pawn Код:
mysql_format(sqlHandle, buffer, sizeof(buffer), "SELECT FROM `samp_users` GET `bank` WHERE `user` = 'Orson_Lynch'");
                           
                            new int_dest = cache_get_row_int(0, 0);
                           
                            int_dest += 100;
                           
                            mysql_format(sqlHandle, buffer, sizeof(buffer), "UPDATE samp_users SET bank = %i WHERE user = 'Orson_Lynch'", int_dest);
                           

                            mysql_format(sqlHandle, buffer, sizeof(buffer), "INSERT INTO `samp_adverts` (`advert`, `owner`) VALUES ('%e', '%e')", inputtext, PlayerInfo[playerid][pName]);
                            mysql_function_query(sqlHandle, buffer, false, "", "");



Re: MySQL Problem - EmilLykke - 03.10.2014

It doesn't really work out, but it works fine when he's ingame, but that's with a different code.


Re: MySQL Problem - Vince - 03.10.2014

Select query is completely wrong since there's no such thing as "GET". That said, you can easily increment a column in the database itself, without having to read it in Pawn first.
PHP код:
UPDATE samp_users SET bank bank 100 WHERE user 'Orson_Lynch'