15.07.2010, 20:02
I'm having trouble with my MySQL. Everytime someone registers. It copys their name over everyone elses. I can't find anything different in the logs.
MySQL Error (0): Could not execute query. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1.
format(query,sizeof(query),"INSERT INTO users (name, password) VALUES ('%s', '%s')",name,password);
format(query,sizeof(query),"UPDATE users SET name='%s', password='%s', admin=%d, cash=%d, score=%d WHERE SQLid=%d",name,AccountInfo[playerid][Password],AccountInfo[playerid][AdminLevel],AccountInfo[playerid][Cash],AccountInfo[playerid][Score],AccountInfo[playerid][mglvl],AccountInfo[playerid][SQLid]);
format(query,sizeof(query),"SELECT SQLid FROM users WHERE name='%s'",name);
printf("%d", AccountInfo[playerid][SQLid]);
This is update:
Код:
format(query,sizeof(query),"UPDATE users SET name='%s', password='%s', admin=%d, cash=%d, score=%d WHERE SQLid=%d",name,AccountInfo[playerid][Password],AccountInfo[playerid][AdminLevel],AccountInfo[playerid][Cash],AccountInfo[playerid][Score],AccountInfo[playerid][mglvl],AccountInfo[playerid][SQLid]); |
format(query,sizeof(query),"UPDATE users SET name='%s', password='%s', admin='%d', cash='%d', score='%d' WHERE name='%s'",name,AccountInfo[playerid][Password],AccountInfo[playerid][AdminLevel],AccountInfo[playerid][Cash],AccountInfo[playerid][Score],AccountInfo[playerid][mglvl],name);