I've a script which Takes $_POST['messages']
and then saves the user's messages to MySQL database.
What's the best approach to prevent SQL Injection and saving the messages(which could be alphabets, numbers, special characters) to the Database so that it won't affect the script+databse queries.
I mean, is there any approach to encode the data or change the special characters to encoded characters like ?
to %3F
so something.
I'm using PHP, MySQL(MySQL PDO Wrapper Class).