重複の可能性:
PHPでSQLインジェクションを防ぐための最良の方法
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');
?>