SA-MP Forums Archive
Large MySQL Query - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Large MySQL Query (/showthread.php?tid=272210)



Large MySQL Query - SchurmanCQC - 27.07.2011

Hey. I feel kind of like a nub asking this, but, this code crashes my server.

pawn Код:
new query[1500];
    format(query, 1500, "UPDATE `users` SET Cash = %d, Admin = %d, Score = %d, Skin = %d", PInfo[playerid][Cash], PInfo[playerid][Admin],PInfo[playerid][Score],PInfo[playerid][Skin]);
    format(query, 1500, "%s, LastX = %f, LastY = %f, LastZ = %f, LastFA = %f, Weapon1 = %d, Weapon2 = %d", query, savex, savey, savez, savefa, PInfo[playerid][Weapon1],PInfo[playerid][Weapon2]);
    format(query, 1500, "%s, Weapon3 = %d, Weapon4 = %d, Weapon5 = %d, Weapon6 = %d, Weapon7 = %d, CellPhone = %d, CellPhoneNo = %d", query, PInfo[playerid][Weapon3], PInfo[playerid][Weapon4], PInfo[playerid][Weapon5], PInfo[playerid][Weapon6], PInfo[playerid][Weapon7], PInfo[playerid][CellPhone], PInfo[playerid][CellPhoneNo]);
    format(query, 1500, "%s, PhoneBook = %d, Car1 = %d, Car2 = %d, Job = %d, Accent = %d, Tutorial = %d, Faction = %d, FactionRank = %d WHERE `username` = '%s'", query, PInfo[playerid][PhoneBook],PInfo[playerid][Car1],PInfo[playerid][Car2],PInfo[playerid][Job], PInfo[playerid][Accent],PInfo[playerid][Tutorial],PInfo[playerid][Faction], PInfo[playerid][FactionRank], name);
    mysql_query(query);
    mysql_free_result();
Regards,
Schurman.


Re: Large MySQL Query - CookieCrusher - 28.07.2011

Don't expect to get help from anyone because that code is meant to be deleted and redone ..


AW: Large MySQL Query - Meta - 28.07.2011

use \" instead of '
For some reason it does not work for me either


Re: Large MySQL Query - JaTochNietDan - 28.07.2011

Well for one thing you're calling mysql_free_result(); when you're not storing any result in that snippet of code!


Re: Large MySQL Query - Grim_ - 28.07.2011

You should be using strcat() instead to concatenate the strings, it's much more efficient, and readable. Also, why are you doing this in the first place? I assume the compiler is spitting out an error for the input line being too long?

Also, debug MySQL and paste the log here. And why do you call mysql_free_result? You're only updating the database.