Large MySQL Query
#1

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.
Reply
#2

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

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

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

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)