无法将Twilio消息接收日期/时间插入MYSQL数据库表

时间:2016-12-21 02:15:49

标签: mysql twilio phone-number

字段名称为 msg_received ,数据类型为 DATETIME

收到Twilio短信时, msg_received 字段填充 0000-00-00 00:00:00

作为一个完整的新手,我认为我已经相当远了,但我不理解这一点。

<?php
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";

$MsgSid = $_REQUEST['MessageSid'];
$SmsSid = $_REQUEST['SmsSid'];
$MsgFrom = $_REQUEST['From'];
$MsgBody = $_REQUEST['Body'];

$host="localhost"; // Host name 
$username="xxxxxxxx"; // Mysql username 
$password="xxxxxxx"; // Mysql password 
$db_name="xxxxxxx"; // Database name 
$tbl_name="xxxxxxx"; // Table name

mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

$sql="INSERT INTO $tbl_name (msg_received, msg_MessageSid, msg_SmsSid, msg_From, msg_Body) VALUES ('CURRENT-TIMESTAMP', '$MsgRecd', '$MsgSid', '$SmsSid', '$MsgFrom', '$MsgBody')";
$result=mysql_query($sql);
?>

0 个答案:

没有答案