无法写入正在PHP插入的SQL DB

时间:2016-03-31 18:01:43

标签: php mysql

人,

如果在这里问过类似的问题,我很抱歉。我生气了...我正在尝试创建PHP,它正在向DB添加记录。请看下面。当我运行代码时,我得到了与数据库的连接的确认。但没有任何东西被添加到表格中......购买记录部分的方式是从phpMyAdmin复制的。上班但却没有。我已经对数据库和表名进行了解析。

仅供参考:我正在尝试在Godaddy托管上设置网页并使用cPanel。

请帮忙......

<?php
$link = mysqli_connect("localhost","usedid","password","database");

if (!$link) {
    echo "Error: Unable to connect to MySQL." . PHP_EOL;
    echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
    echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
    exit;
}

echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL;
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;


$sql = "INSERT INTO `mezenne_hourly` (`ID`, `TIME`, `DATE`, `USD_SELL`, `EUR_SELL`, `GBP_SELL`, `RRU_SELL`, `USD_BUY`, `EUR_BUY`, `GBP_BUY`, `RRU_BUY`) VALUES (NULL, CURRENT_TIME(), CURRENT_DATE(), \'88\', \'88\', \'88\', \'88\', \'88\', \'88\', \'88\', \'88\');";

/* $sql = "INSERT INTO `mezenne_db`.`mezenne_hourly` (`ID`, `TIME`, `DATE`, `USD_SELL`, `EUR_SELL`, `GBP_SELL`, `RRU_SELL`, `USD_BUY`, `EUR_BUY`, `GBP_BUY`, `RRU_BUY`) VALUES (NULL, CURRENT_TIME(), CURRENT_DATE(), \'88\', \'88\', \'88\', \'88\', \'88\', \'88\', \'88\', \'88\');"; */

mysqli_close($link);
?>

谢谢!

0 个答案:

没有答案