07.05.2018, 16:39
MySQL log is clean.
But the data is still not saved.
But the data is still not saved.
PHP код:
stock CreateNewAccount(playerid, password[])
{
new query_string[1000+MAX_PLAYER_NAME-4+1000];
format(query_string, sizeof(query_string), "INSERT INTO `accounts` (`player_name`, `password`, `sex`, `rasa`, `religia`) VALUES ('%s', '%s', '%d', '%d', '%d')", pInfo[playerid][pName], password, pInfo[playerid][pSex], pInfo[playerid][pRasa], pInfo[playerid][pReligia]);
mysql_function_query(mysql_connect_ID, query_string, true, "UploadPlayerAccountNumber", "i", playerid);
format(query_string, sizeof(query_string),"{FFFFFF}Шаг 1/4 {FF4500}|{FFFFFF} Пароль для аккаунта %s успешно сохранён.", pInfo[playerid][pName]);
SendClientMessage(playerid, 0xFFFFFF00, query_string);
return 1;
}
forward UploadPlayerAccount(playerid);
public UploadPlayerAccount(playerid)
{
pInfo[playerid][pID] = cache_get_field_content_int(0, "id", mysql_connect_ID);
pInfo[playerid][pSex] = cache_get_field_content_int(0, "sex", mysql_connect_ID);
pInfo[playerid][pRasa] = cache_get_field_content_int(0, "rasa", mysql_connect_ID);
pInfo[playerid][pReligia] = cache_get_field_content_int(0, "religia", mysql_connect_ID);
SendClientMessage(playerid, 0xFFFFFF00, "{FF4500}| {FFFFFF}Вы успешно авторизировались!");
SpawnPlayer(playerid);
return 1;
}
/* ======================================================================== */
stock SaveAccount( playerid )
{
new query_string[ 5000 ];
format( query_string, sizeof( query_string ), "UPDATE `accounts` SET `player_name` = '%s', `sex` = '%s', `rasa` = '%s', \
`religia` = '%s' WHERE `id` = '%d'", pInfo[ playerid ][ pName ], pInfo[ playerid ][ pPassword ], pInfo[ playerid ][ pSex ], pInfo[ playerid ][ pRasa ],
pInfo[ playerid ][ pReligia ], pInfo[ playerid ][ pID ] );
mysql_function_query( mysql_connect_ID, query_string, false, "", "" );
return printf("Данные аккаунта № %d (%s) были сохранены.", pInfo[playerid][pID], pInfo[playerid][pName]);
}