PHP:SELECT INTO OUTPUT FILE语句不起作用

时间:2013-10-10 08:58:47

标签: php mysql

我有脚本将获取我的sql结果并将其添加到csv中。但似乎它不想保存到运行脚本的目录中。

我的剧本

/* Connecting, selecting database */
$db_link = mysql_connect("localhost", "root", "");
if (!$db_link) {
   die("Could not connect: " . mysql_error());
}
mysql_select_db("mydb") or die("Could not select database");

/* Performing SQL query */
$sql_1="SELECT id,date,ref_id,new_id INTO OUTFILE 'file.csv' FIELDS TERMINATED BY ',' ";
$sql_2="OPTIONALLY ENCLOSED BY '"."\"' ";
$sql_3="LINES TERMINATED BY '"."\\n' FROM check_log";

$sql = $sql_1.$sql_2.$sql_3;
mysql_query($sql,$db_link);

/* Closing connection */
mysql_close($db_link);


echo "DONE";

0 个答案:

没有答案