可能重複:
Best way to prevent SQL Injection in PHP如何更改普通的sql php代碼來保護pdo?
這是代碼的安全,因爲我使用mysql_real_escape_string和strip_tags的 有沒有必要改變,以PDO? 我無法將以下代碼轉換爲pdo,因爲它的顯示無法修改標題。
<?php
include('config.php');
$link =mysql_connect($db_host,$username,$password);
mysql_select_db($db_name);
$id= $_POST["uniqi"];
$comments= $_POST["comments"];
$comments= mysql_real_escape_string($comments);
$comments = strip_tags($comments);
$update = "UPDATE mastertable SET comments = '$comments' WHERE id_pk= '$id'";
mysql_query($update, $link);
mysql_close();
header('Location: http://www.xxxx.com/xxxxx/xxxx.php?cntmsg=Comment Updated');
?>
您應該將其轉換爲PDO - mysql擴展[正在被棄用](http://news.php.net/php.internals/53799)。 – DCoder 2012-07-08 15:50:42
http://stackoverflow.com/questions/8028957/headers-already-sent-by-php – PeeHaa 2012-07-08 15:51:33