我的问题是,在一台服务器上,以下sqlite查询将起作用,而在另一台服务器上,sqlite查询将打印为纯文本格式。
代码如下:
<?
$db = new SQLite3("../data/data.db");
if (!empty($_POST['inputDateTime']) && !empty($_POST['inputShortName']) && !empty($_POST['textareaBreakingnews']))
{
$received_date = $_POST['inputDateTime'];
$received_short_name = mb_strtoupper($_POST['inputShortName']);
$received_breaking_news = $_POST['textareaBreakingnews'];
$query = $db->query("INSERT INTO news (news_text, date_created, callback_person) VALUES ('$received_breaking_news', '$received_date', '$received_short_name')");
if ($query)
{
echo "News were added.";
}
else
{
die(header("HTTP/1.0 404 Not Found"));
}
}
结果如下:
query(“ INSERT INTO news(news_text,date_created,callback_person)VALUES('$ received_breaking_news','$ received_date','$ received_short_name')”); if($ query){echo“添加了新闻。”; } else {die(header(“ HTTP / 1.0 404 Not Found”)); }
在xampp配置中启用了sqlite和sqlite3,并且读取sqlite数据库没有问题。
我认为我忽略了一件小事。