このコードを実行しようとすると:
<?php
$str = "Patty O'Furniture";
if(get_magic_quotes_gpc())
echo stripslashes($str);
?>
出力は次のとおりですPatty O'Furniture
が、このコードを実行しようとすると(データをデータベーステーブルにアップロードします)
<?php
if ($_FILES[csv][size] > 0) {
//get the csv file
$file = $_FILES[csv][tmp_name];
$handle = fopen($file,"r");
//loop through the csv file and insert into database
do {
if ($data[0]) {
if(get_magic_quotes_gpc())
mysql_query("INSERT INTO sms_recipient (store_id, recipient_name, recipient_phone) VALUES
(
'".$login_id."',
'".stripslashes($data[0])."',
'".stripslashes($data[1])."'
)
");
}
} while ($data = fgetcsv($handle,1000,",","'"));
//
}
?>
出力のみPatty O
。(スクリーンショットを参照)
関数を使用してデータベースにデータを保存しようとすると、機能しない理由がわかりませstripslashes
ん。