0

User input will be another language with English. So I want to sanitize data before putting it on mysql database.

So here is my code:

mysqli_set_charset($conn,"utf8");
function sanitize_data($data) {
    global $conn;
    $output = '';
    if(isset($data)) {
        $output = mysqli_real_escape_string($conn, $data);
    }
    return $output;
}

Is there any way to make it more sanitized? Website will be public forum/blog type. Anyone can write if they are registered.

crazymoin
  • 336
  • 3
  • 13

0 Answers0