MySQL Syntax Error
#2

You should really set all columns in which you want to store a 0 (as in your extremely long query) to have a default value of "0" using a tool that can browse your mysql tables (like Navicat).

That will shorten your query alot and you will find mistakes alot easier.

Your query could be reduced to:
PHP код:
format(query1160"INSERT INTO `players` (`username`, `password`, `IP`) VALUES('%s', SHA1('%s'), '%s')"GetName(playerid), passwordstringpInfo[playerid][pIP]); 
All other fields don't need to be inserted into your query if you set all those columns to default value of 0, because mysql will fill them in by itself if not supplied.
Note that the length of the query went from 750 to 160 (the maximim size of characters that would ever be inserted into the query: 24 chars for the name, 16 for the IP and 40 for the SHA1 hash).
That's about 1/5th the size of the original query, and does exactly the same thing when someone registers a new account.

Your actual problem was that you were mixing up both strings:
PHP код:
strcat(stringquery1);
mysql_query(query1); 
It should be:
PHP код:
strcat(stringquery1);
mysql_query(string); 
You were only sending the second part (starting from VALUES ...), instead of the merged query, which is stored into "string".
Reply


Messages In This Thread
MySQL Syntax Error - by JaKe Elite - 19.05.2015, 23:32
Re: MySQL Syntax Error - by PowerPC603 - 19.05.2015, 23:47
Re: MySQL Syntax Error - by JaKe Elite - 20.05.2015, 00:25

Forum Jump:


Users browsing this thread: 1 Guest(s)