mysqli插入查询似乎不适用于ajax

时间:2022-03-19 00:06:22

http://pastebin.com/VUHbRAuW

I am using ajax, the query did sent but this php page have error, it return nothing, I suspect it was the sql query part.

我正在使用ajax,查询确实发送但是这个php页面有错误,它什么也没有返回,我怀疑它是sql查询部分。

    if($user = $db->query("INSERT INTO post_items(content,date,category_id) VALUES ('$content', '$date', '$category_id'")){

}

1 个解决方案

#1


0  

If you want to return something from PHP to your AJAX call you need to use json_encode i.e.

如果你想从PHP返回一些你的AJAX调用,你需要使用json_encode即

echo json_encode(array('result' => 'success'));

#1


0  

If you want to return something from PHP to your AJAX call you need to use json_encode i.e.

如果你想从PHP返回一些你的AJAX调用,你需要使用json_encode即

echo json_encode(array('result' => 'success'));