SA-MP Forums Archive
Server crashing (for MySQL) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Server crashing (for MySQL) (/showthread.php?tid=394584)



Server crashing (for MySQL) - KarTooN - 23.11.2012

My server is sometimes crashing, when player first spawned or log

Server Log:
Код:
[21:58:39] MySQL Query: SELECT * FROM `Users` WHERE Nick = 'petricha'
[21:58:39] Player petricha first spawned
[21:58:39] Player petricha spawn -2
[21:58:39] Player petricha spawn -1
[21:58:39] Player petricha spawn 0
[21:58:39] Player petricha spawn 1
Script:
Quote:

new Query[550],get[35];
mysql_free_result();
format(Query,sizeof(Query),"SELECT * FROM `Users` WHERE Nick = '%s'",pName(playerid));
mysql_query(Query);
mysql_store_result();
printf("Player %s first spawned",pName(playerid));
printf("Player %s spawn -2",pName(playerid)),mysql_fetch_field("Zivot",get) ,printf("Player %s spawn -1",pName(playerid));
printf("Player %s spawn 0",pName(playerid));
SetPVarFloat(playerid,"Zivot",floatround(floatstr( get)));
printf("Player %s spawn 1",pName(playerid));
mysql_fetch_field("PosX",get);

Do you know, what can be wrong?


Re: Server crashing (for MySQL) - ReneG - 23.11.2012

How did this code even compile?

You're calling mysql_free_result before storing it, and mysql_fetch_field is used to fetch fields by index, not name.


Re: Server crashing (for MySQL) - KarTooN - 24.11.2012

How can i repair it? This is my first work with MySQL