SA-MP Forums Archive
MYSQL Problem - 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: MYSQL Problem (/showthread.php?tid=537433)



MYSQL Problem - AwokenNeoX - 15.09.2014

If I use /setlevel my Level change in Game but not in my database is there a mistake in this line ?

PHP код:
format(query,sizeof(query),"UPDATE user SET Score='%i',money='%i',AdminLevel='%i', WHERE ID='%i'",sInfo[playerid][Score],GetPlayerMoney(playerid),sInfo[playerid][AdminLevel],sInfo[playerid][ID]); 
MYSQL_LOG.TXT
PHP код:
[16:13:40] [ERRORCMySQLQuery::Execute[()] - (error #1064) 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 'WHERE ID='1'' at line 1 



Re: MYSQL Problem - Eth - 15.09.2014

pawn Код:
format(query,sizeof(query),"UPDATE `user` SET `Score`='%d',`money`='%d',`AdminLevel`='%i' WHERE ID='%d'",sInfo[playerid][Score],GetPlayerMoney(playerid),sInfo[playerid][AdminLevel],sInfo[playerid][ID]);
mysql_query(query);



AW: MYSQL Problem - AwokenNeoX - 15.09.2014

Still the same Error...


Re: MYSQL Problem - Eth - 15.09.2014

I edited my post


AW: MYSQL Problem - AwokenNeoX - 15.09.2014

Thank you but can you say me what you edit and where the Problem was I gave you rep


Re: MYSQL Problem - MikeEd - 15.09.2014

You never put a comma before "WHERE", thats where the problem was occuring


Re: MYSQL Problem - Eth - 15.09.2014

not this only MikeEd, you should also add two ` ` between the user word and all the other enums like score kills etc


Re: MYSQL Problem - Ox1gEN - 15.09.2014

Quote:
Originally Posted by Eth
Посмотреть сообщение
not this only MikeEd, you should also add two ` ` between the user word and all the other enums like score kills etc
Nope, you are not supposed to use ` ` "between the user word an all the other enum".

They are unnecessary. I don't use ` `, I just use ' ' for strings, that's all.
Everything that isn't a string doesn't require ` `.


Re: MYSQL Problem - DobbysGamertag - 15.09.2014

You should consider learning MySQL before continuing.

http://www.w3schools.com/sql/ basic stuff here.

You could compromise your entire database if you use mysql incorrectly.


Re: MYSQL Problem - rickisme - 15.09.2014

Red = error
Green = don't need

Quote:

format(query,sizeof(query),"UPDATE user SET Score='%i',money='%i',AdminLevel='%i', WHERE ID='%i'",sInfo[playerid][Score],GetPlayerMoney(playerid),sInfo[playerid][AdminLevel],sInfo[playerid][ID]);