Problem with mysql.
#1

Hello everyone.
Why does this function doesn't save data?

Код:
function SaveAccount(playerid) {
    GetPlayerPos(playerid, AccountData[playerid][Spawn][0],AccountData[playerid][Spawn][1],AccountData[playerid][Spawn][2]);
    GetPlayerFacingAngle(playerid, AccountData[playerid][Spawn][3]);
    AccountData[playerid][InteriorSpawn] = GetPlayerInterior(playerid);
    AccountData[playerid][WorldSpawn] = GetPlayerVirtualWorld(playerid);
    
    format(string,sizeof(string), "UPDATE Accounts SET AdminLevel=%i,Money=%i,Bank=%i,Faction=%i,Rank=%i,HouseKey=%i,BizKey=%i,Skin=%i,Spawn1='%f',Spawn2='%f',Spawn3='%f',Spawn4='%f',Spawn5=%i,Reg=%i,Sex=%i,Wallet=%i,Renting=%i,Products=%i,PhoneNumber=%i,Minutes=%i,Spawn6=%i,Arrested=%i,Prisoned=%i,Jailed=%i,JailTime=%i, \
	Cell=%i,Towe=%i,License=%i,Linked=%i,ForumName='%s',ForumPassword='%s',wLicense=%i,Job=%i,Donator=%i,CarParts=%i,PlayingTime=%i,FightingStyle=%i WHERE Name = '%s'",
    AccountData[playerid][AdminLevel],GetPlayerCash(playerid),AccountData[playerid][Bank],
	AccountData[playerid][Faction],AccountData[playerid][Rank],AccountData[playerid][HouseKey],
	AccountData[playerid][BizKey],GetPlayerSkin(playerid),AccountData[playerid][Spawn][0],AccountData[playerid][Spawn][1],AccountData[playerid][Spawn][2],AccountData[playerid][Spawn][3],
	AccountData[playerid][InteriorSpawn],AccountData[playerid][Reg],AccountData[playerid][Sex],GetPlayerWalletCash(playerid),AccountData[playerid][Renting],AccountData[playerid][Products],
	AccountData[playerid][PhoneNumber],AccountData[playerid][Minutes],AccountData[playerid][WorldSpawn],AccountData[playerid][Arrested],AccountData[playerid][Prisoned],AccountData[playerid][Jailed],
	AccountData[playerid][JailTime],AccountData[playerid][Cell],AccountData[playerid][Towe],AccountData[playerid][License], AccountData[playerid][Linked], AccountData[playerid][ForumName],
	AccountData[playerid][ForumPassword],AccountData[playerid][wLicense],AccountData[playerid][pJob], AccountData[playerid][Donator], AccountData[playerid][CarParts], AccountData[playerid][PlayingTime],
	AccountData[playerid][FightingStyle],GetUserName(playerid));
	mysql_query(string, MYSQL_SAVE_USERS);
	
	format(string,sizeof(string), "UPDATE Accounts SET Materials=%i WHERE Name = '%s'",
    AccountData[playerid][Materials],GetUserName(playerid));
	mysql_query(string, MYSQL_SAVE_USERS);
	
	format(string, sizeof(string), "UPDATE enrolled SET Classes=%i WHERE Name = '%s'", AccountData[playerid][Classes],
	GetUserName(playerid));
	mysql_query(string);
	
	format(string, sizeof(string), "UPDATE scholarships SET Psychology=%i,Criminal_Justice=%i,Medicine=%i WHERE Name = '%s'", UniversityData[playerid][Psychology], UniversityData[playerid][Criminal_Justice],
	UniversityData[playerid][Medicine],GetUserName(playerid));
	mysql_query(string);
	
	format(string, sizeof(string), "UPDATE drugs SET Cocaine=%d,Crack=%d,Heroin=%d,Hydrocodone=%d,\
	Inhalants=%d,LSD=%d,Marijuana=%d,MDMA=%d,Methamphetamine=%d,Anabolic_Steroids=%d,Needles=%d,Blunts=%d WHERE Name = '%s'",
	PlayerDrugData[playerid][Cocaine],PlayerDrugData[playerid][Crack],PlayerDrugData[playerid][Heroin],PlayerDrugData[playerid][Hydrocodone],
	PlayerDrugData[playerid][Inhalants],PlayerDrugData[playerid][LSD],PlayerDrugData[playerid][Marijuana],PlayerDrugData[playerid][MDMA],
	PlayerDrugData[playerid][Methamphetamine],PlayerDrugData[playerid][Anabolic_Steroids],PlayerDrugData[playerid][Needles],PlayerDrugData[playerid][Blunts],GetUserName(playerid));
	mysql_query(string);
	
	format(string, sizeof(string), "UPDATE Settings SET Turfs=%i,SAN=%i,Phone=%i,Room=%i WHERE Name = '%s'", PlayerSettingsData[playerid][TurfTog], PlayerSettingsData[playerid][SANTog],
	PlayerSettingsData[playerid][PhoneTog], PlayerSettingsData[playerid][RoomTog],GetUserName(playerid));
	mysql_query(string);
	
 	SavePlayerWeapons(playerid);
	SavePlayerWeaponsAmmo(playerid);
}
MySQL logs at saving. What can be wrong?

Код:
[20:15:43] CMySQLHandler::Query(UPDATE Accounts SET AdminLevel=1337,Money=500,Bank=0,Faction=999,Rank=999,HouseKey=999,BizKey=999,Skin=101,Spawn1='1977.129516',Spawn2='-1962.138916',Spawn3='16.694032',Spawn4='81.130676',Spawn5=0,Reg=1,Sex=1,Wallet=200,Renting=-1,Products=0,PhoneNumber=0,Minutes=0,Spawn6=0,Arrested=0,Prisoned=0,Jailed=0,JailTime=2, Cell=1,Towe=0,License=0,Linked=0,ForumName='0',ForumPassword='0',wLicense=0,Job=0,Donator=0,CarParts=0,PlayingTime=0,FightingStyle=0 WHERE Name = 'Jack Qeee',resultID) - Threaded query with id 3 started. (Extra ID: -1)

[20:15:43] >> mysql_query( Connection handle: 1 )

[20:15:43] CMySQLHandler::Ping() - An error has occured (Lost connection to MySQL server during query, Error ID: 2013)

[20:15:43] CMySQLHandler::Query(UPDATE Weapons SET Weapon1=0,Weapon2=0,Weapon3=0,Weapon4=0,Weapon5=0,Weapon6=0,Weapon7=0,Weapon8=0,Weapon9=0,Weapon10=0,Weapon11=0,Weapon12=0, Weapon13=0 WHERE Name = 'Jack Qeee') - Successfully executed.

[20:15:43] CMySQLHandler::ProcessQueryThread(UPDATE Accounts SET AdminLevel=1337,Money=500,Bank=0,Faction=999,Rank=999,HouseKey=999,BizKey=999,Skin=101,Spawn1='1977.129516',Spawn2='-1962.138916',Spawn3='16.694032',Spawn4='81.130676',Spawn5=0,Reg=1,Sex=1,Wallet=200,Renting=-1,Products=0,PhoneNumber=0,Minutes=0,Spawn6=0,Arrested=0,Prisoned=0,Jailed=0,JailTime=2, Cell=1,Towe=0,License=0,Linked=0,ForumName='0',ForumPassword='0',wLicense=0,Job=0,Donator=0,CarParts=0,PlayingTime=0,FightingStyle=0 WHERE Name = 'Jack Qeee', Resultid: 3) - An error has occured in your query. (MySQL server has gone away))

[20:15:43] >> mysql_query( Connection handle: 1 )

[20:15:43] CMySQLHandler::Query(UPDATE WeaponsAmmo SET Weapon1=0,Weapon2=0,Weapon3=0,Weapon4=0,Weapon5=0,Weapon6=0,Weapon7=0,Weapon8=0,Weapon9=0,Weapon10=0,Weapon11=0,Weapon12=0, Weapon13=0 WHERE Name = 'Jack Qeee') - An error has occured. (Error ID: 2006, MySQL server has gone away)

[20:16:03] >> mysql_ping( Connection handle: 1 )

[20:16:03] CMySQLHandler::Ping() - An error has occured (MySQL server has gone away, Error ID: 2006)

[20:16:03] >> mysql_reconnect( Connection handle: 1 )
Reply
#2

Check your mysql_connect info to see if it's the right info.
Reply
#3

Quote:
Originally Posted by TheLazySloth
Посмотреть сообщение
Check your mysql_connect info to see if it's the right info.
Yes the info is right..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)