SA-MP Forums Archive
MySQL not working? - 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 not working? (/showthread.php?tid=425835)



MySQL not working? - BittleRyan - 26.03.2013

Pastebin: http://pastebin.com/uZjrfkiB

I am trying to learn the basics of scripting in SAMP as well as the basics of MySQL. The above is the revelant script. Can anybody point me in the right direction? Why is it not saving my money?


Re: MySQL not working? - Frede - 26.03.2013

This was here ive learned mysql https://sampforum.blast.hk/showthread.php?tid=159785
Does it load the money?

*EDIT the reason that the server arent saving your data is you did UPDATE 'playerdata' SET 'money'='%d' WHERE 'user'='%s'

It should be UPDATE playerdata SET money=%d WHERE user='%s'

Do only use of ' in strings


Re: MySQL not working? - BittleRyan - 26.03.2013

No it does not, nothing loads. So either it is not saving or not loading. Or both.


Re: MySQL not working? - Frede - 26.03.2013

ive made a edit of my post

You can also use `

That would look like this: It should be UPDATE `playerdata` SET money=%d WHERE user='%s'

Maybe, just a advise, test your querys in phpmyadmin before you put them iin the script


Re: MySQL not working? - kamzaf - 27.03.2013

the stocks are usually put at the end of the FS or GM.


Re: MySQL not working? - BittleRyan - 27.03.2013

Here is an update: http://pastebin.com/yzaZSWqG

I followed Frede's advice, and it is still not working.


Re: MySQL not working? - [ABK]Antonio - 27.03.2013

pawn Код:
format(query, 500, "UPDATE 'playerdata' SET money = %d WHERE user='%s'", pInfo[playerid][pName]);
pawn Код:
format(query, 500, "UPDATE 'playerdata' SET money = %d WHERE user='%s'", pInfo[playerid][pMoney], pInfo[playerid][pName]);



Re: MySQL not working? - BittleRyan - 27.03.2013

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
pawn Код:
format(query, 500, "UPDATE 'playerdata' SET money = %d WHERE user='%s'", pInfo[playerid][pName]);
pawn Код:
format(query, 500, "UPDATE 'playerdata' SET money = %d WHERE user='%s'", pInfo[playerid][pMoney], pInfo[playerid][pName]);
Put that in there, still does not work. However, I tested out the queries in phpmyadmin and they work.

EDIT: To clarify, I did not get the script to update the MySQL tables. However, if I manually enter the query within phpmyadmin, they work. Just not within the script.