Saving usernames with '(' or ')' in mysql
#1

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);
Reply
#2

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)