Hi, How can I prevent MySQL injection in text fields and forms? Can someone provide a code example? Is it basically taking commas out of the user input? Thanks,
it's not taking commas, it's escaping stuff like single quote ' mysql_real_escape_string($_POST['form_input_name'])
You can do tests based on what you expect the input to be, and what crivion said is a really good call before you test. Just remember never to use raw input data collected by the form (test the value before sending it through SQL)
I would suggest you to read up about PHP's PDO (php.net/pdo). It allows you to insert dynamic content to SQL queries using a sort of placeholders, so that the database library takes care of all the escaping for you.