我写了一个PHP脚本到一个文本文件中的内容插入到MySQL数据库和我的文件的A.TXT内容PHP脚本文件的内容加载到MySQL数据库
\ n用于新行
我希望它被加载到数据库中包含特殊字符 \ n
因为它是... 但正在加载仅“用于新行” 好心帮我... 感谢名单
<?php
$filename = "a.txt";
$f = fopen($filename, 'r');
$total_contents = fread($f, filesize($filename));
print $total_contents;
mysql_connect("localhost", "datab_user", "password") or die(mysql_error());
mysql_select_db("datab_name") or die(mysql_error());
mysql_query("INSERT INTO table_name
(id,content) VALUES(333,'$total_contents') ")
or die(mysql_error());
?>
你不能使用load data infile - http://dev.mysql.com/doc/refman/5.1/en/load-data.html ??比较... – 2010-10-26 07:15:37