MySQL not working?
#1

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?
Reply
#2

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
Reply
#3

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

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
Reply
#5

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

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

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

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]);
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)