db_name我正在尝试使用JSON API将内容添加到MySQL数据库。
INSERT INTO `ersmdb_cartpauj_pm_messages`
(from_user, to_user, message_contents, message_read, date)
VALUE (CASE WHEN from_user THEN {userid}
AND to_user THEN {myid}
AND message_contents THEN {message}
AND message_read THEN 1
AND date THEN CURRENT_TIMESTAMP)
但在我的网址查询时收到错误:www.domain.com/api/addcontent/?userid = 1& myid = 2&amp ;message = hello
有没有人知道如何将动态内容添加到VALUE中:
VALUE ('1','2','hello','1',CURRENT_TIMESTAMP)
答案 0 :(得分:0)
这是你想要做的吗?
INSERT INTO ersmdb_cartpauj_pm_messages(from_user, to_user, message_contents, message_read, date)
SELECT {userid}, {myid}, {message}, 1, CURRENT_TIMESTAMP;
我不确定case
逻辑应该用insert
做什么。所有领域都是必需的。