PHP Sanitize Data

前端 未结 4 1611
清歌不尽
清歌不尽 2020-12-08 22:56

I am new to the world of coding and PHP hence would like to learn what\'s the best way to sanitize form data to avoid malformed pages, code injections and the like. Is the s

4条回答
  •  半阙折子戏
    2020-12-08 23:34

    As a general rule if you are using PHP & MySQL you will want to sanitize data going into MySQL like so:

    $something = mysql_real_escape_string($_POST['your_form_data']);
    

    http://php.net/manual/en/function.mysql-real-escape-string.php

提交回复
热议问题