12.12.2016, 00:17
So i was trying to do a login/register system with mysql, i'm using mysql version r33
so basically i was trying to make a stock to save player data, the code is correct but it's not updating on mysql,
here is the code of the stock
In the mysql debug, there is no errors too
Thanks in advance.
so basically i was trying to make a stock to save player data, the code is correct but it's not updating on mysql,
here is the code of the stock
Код:
stock SavePlayerData(playerid) { new Query[1000],PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME); PlayerInfo[playerid][Cash] = GetPlayerMoney(playerid); GetPlayerPos(playerid, PlayerInfo[playerid][LastPosX], PlayerInfo[playerid][LastPosY], PlayerInfo[playerid][LastPosZ]); GetPlayerHealth(playerid, PlayerInfo[playerid][Health]); GetPlayerArmour(playerid, PlayerInfo[playerid][Armour]); mysql_format(MySQL, Query, sizeof(Query), "UPDATE `players` SET `NormalName` = '%s', `Password` = '%s', `Cash` = '%d', `BankMoney` = '%d', `LastPosX` = '%f', `LastPosY` ='%f',`LastPosZ` = '%f',`Health` = '%f',`Armour` = '%f' WHERE `NormalName` = '%f' LIMIT 1", PlayerName, RetrievePassword(playerid), PlayerInfo[playerid][Cash], PlayerInfo[playerid][BankMoney], PlayerInfo[playerid][LastPosX], PlayerInfo[playerid][LastPosY], PlayerInfo[playerid][LastPosZ], PlayerInfo[playerid][Health], PlayerInfo[playerid][Armour], PlayerName); mysql_query(MySQL, Query); }
Код:
[02:03:48] [DEBUG] mysql_format - connection: 1, len: 1000, format: "UPDATE `players` SET `NormalName` = '%s', `Password` = '%s', `Cash` = '%d', `BankMoney` = '%d', `LastPosX` = '%f', `LastPosY` ='..." [02:03:49] [DEBUG] mysql_query - connection: 1, query: "UPDATE `players` SET `NormalName` = 'Alexander_Cooper', `Passwor" [02:03:49] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called [02:03:49] [DEBUG] CMySQLQuery::Execute[()] - starting query execution [02:03:49] [DEBUG] CMySQLQuery::Execute[()] - query was successful [02:03:49] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [02:03:49] [DEBUG] CMySQLHandle::SaveActiveResult - cache saved with ID = 2 [02:03:49] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called