简体   繁体   English

查询不会插入表中

[英]Query won't INSERT into table

Before any of you ask, I have an array which prints perfect infomation. 在你们问之前,我有一个打印完美信息的数组。 I have an implode statement and an insert statement which don't seem to be working and i don't know where the problem is. 我有一个implode语句和一个insert语句,它们似乎不起作用,我也不知道问题出在哪里。

A blank webpage is returned with no information. 返回一个空白页面,没有任何信息。 Is there something wrong with my code? 我的代码有问题吗?

My code is below. 我的代码如下。 Any ideas? 有任何想法吗?

$data = '"' . implode('" , "', $news_stories) . '"';
$query = mysql_query("INSERT INTO news_story (`title`, `description`, `keywords`, `link`) VALUES (" . $data . ")")or die(mysql_error()); 

Nothing is returned. 什么也没退。

add or die(mysql_error()) at the end of your query to see what exactly the problem is. 在查询末尾添加or die(mysql_error()) ,以查看问题出在哪里。

$query = mysql_query("INSERT INTO news_story (`title`, `description`, `keywords`, `link`) VALUES (" . $data . ")") or die(mysql_error());

I think the problem would be with the implode function but since i don't know what data is in it i cant say for sure. 我认为问题可能在于爆破功能,但由于我不知道其中包含什么数据,因此无法确定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM