04.01.2015, 12:18
Hey,
I've been trying to script the base of a MySQL Bank System, and it doesn't seem to save the data.
I have 3 different functions,
LoadBank, SaveBank, CreateBank.
So I have placed LoadBank under my MySQL login function, SaveBank on disconnect and CreateBank on mmy MySQL register function.
It doesn't seem to work. A new player has registered and their name wasn't saved to the table Banks
How am I able to fix this problem?
Thanks,
FunnyBear
I've been trying to script the base of a MySQL Bank System, and it doesn't seem to save the data.
I have 3 different functions,
pawn Код:
LoadBank(playerid)
{
new
name[ MAX_PLAYER_NAME ],
query[ 300 ];
GetPlayerName(playerid, name, sizeof(name));
format(query, sizeof(query), "SELECT * FROM Bank WHERE Name='%s'", name);
mysql_query(query);
new String[ 40 ];
mysql_store_result();
while(mysql_fetch_row_format(query,"|"))
{
mysql_fetch_field_row(bInfo[playerid][bMoney],"bMoney");
mysql_fetch_field_row(String,"AccID"); bInfo[playerid][AccID] = strval(String);
}
mysql_free_result();
}
SaveBank(playerid)
{
new
name[ MAX_PLAYER_NAME ],
str[ 300 ];
GetPlayerName(playerid, name, sizeof(name));
format(str,sizeof(str),"UPDATE Bank SET bMoney=%d WHERE Name='%s'", bInfo[playerid][bMoney], name);
mysql_query(str);
}
CreateBank(playerid)
{
new
name[ MAX_PLAYER_NAME ],
query[ 300 ];
GetPlayerName(playerid, name, sizeof(name));
format(query, sizeof(query), "INSERT INTO Bank (Name, Money) VALUES('%s', 0)", name);
mysql_query(query);
mysql_free_result();
}
So I have placed LoadBank under my MySQL login function, SaveBank on disconnect and CreateBank on mmy MySQL register function.
It doesn't seem to work. A new player has registered and their name wasn't saved to the table Banks
How am I able to fix this problem?
Thanks,
FunnyBear