我正在寻找/制作剧本。我只是不确定它是否会起作用。我有一些使用prestashop和magento的在线商店。用户可以在那里订阅时事通讯。每次我想导出订阅者我需要下载.csv文件并将其上传到我的订阅者所在的数据库。 我想制作或找到一个允许我点击导出的脚本,脚本应该将订阅者直接导出到数据库,而无需下载文件。
我计划用这样的东西更改现有的导出脚本,这是否合适,或者是否有人有更好更容易的解决方案?:
<?php
$host="localhost";
$username="root";
$password="";
$db_name="test";
$tbl_name="subscribers";
$link = mysql_connect("localhost", "root", "") or die ("error");
mysql_select_db("test", $link) or die ("Connection fail");
$id = $_POST['id'];
$userID = $_POST['userID'];
$name = $_POST['name'];
$email = $_POST['email'];
$custom_fields = $_POST['custom_fields'];
$list = $_POST['list'];
$unsubscribed = $_POST['unsubscribed'];
$bounced = $_POST['bounced'];
$bounce_soft = $_POST['bounce_soft'];
$complaint = $_POST['complaint'];
$last_campaing = $_POST['last_campaing'];
$last_ares = $_POST['last_ares'];
$timestamp = $_POST['timestamp'];
$join_date = $_POST['join_date'];
$confirmed = $_POST['confirmed'];
$messageID = $_POST['messageID'];
$sql="INSERT INTO test(id, userID, name, email, custom_fields, list, unsubscribed, bounced, bounce_soft, complaint, last_campaing, last_ares, timestamp, join_date, confirmed, messageID)VALUES('$id', '$userID', '$name', '$email', '$custom_fields', '$list', '$unsubscribed', '$bounced', '$bounce_soft', '$complaint', '$last_campaing', '$last_ares', '$timestamp', '$join_date', '$confirmed', '$messageID')";
$result=mysql_query($sql);
if($result){
echo "error";
}
?>
<?php
mysql_close();
?>
答案 0 :(得分:0)
我认为你可以为两者获得一个模块。但是那个脚本不起作用。您需要查看服务器是否授予对商店数据库的远程访问权限并使用正确的路径。