SA-MP Forums Archive
Saving usernames with '(' or ')' in mysql - 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: Saving usernames with '(' or ')' in mysql (/showthread.php?tid=364879)



Saving usernames with '(' or ')' in mysql - DeathTone - 01.08.2012

I've come across an issue where when a player joins with a '(' or a ')' symbol in their username, it does not register the username for some reason, how can I fix this?

pawn Код:
format(query, sizeof(query), "INSERT INTO players (user) VALUES('%s')", pname);
mysql_query(query);



Re: Saving usernames with '(' or ')' in mysql - DeathTone - 01.08.2012

Nevermind, it does save, I guess it was just an issue with my player stats webpage.


Re: Saving usernames with '(' or ')' in mysql - Johnson_boy - 01.08.2012

That's called mysql injection. You should always escape any user input.

A mean player could join with name '); TRUNCATE TABLE `players`, and it would delete all your users.

So take a look at function mysql_real_escape_string