我的SQL语法中的错误不允许插入表中

时间:2016-04-26 01:48:30

标签: mysql datetime

我试着编写一个非常(假设)简单的代码片段,将数据放入我的数据库。

$sql = "INSERT INTO  `clubevent` (clubevent_id ,club_id ,event_id ,theme_id ,clubevent_date ,clubevent_start_time ,clubevent_finish_time ,clubevent_cost) VALUES (NULL ,  $clubstate,  $eventstate,  $themestate,  $datestate,  $sTimestate,  $fTimestate,  $coststate)";

然而我不断收到消息

  

错误:INSERT INTO clubevent(clubevent_id,club_id,event_id,theme_id,clubevent_date,clubevent_start_time,clubevent_finish_time,clubevent_cost)VALUES(NULL,4,14,2,2016-04-26,23:00:00:00 ,05:00:00,05)   您的SQL语法有错误;查看与您的MariaDB服务器版本对应的手册,以便在第1行':00:00,05:00,05)附近使用正确的语法

我试图进入的数据是:

  

4,14,2,2016-04-26,23:00:00,05:00:00,05

任何人都能对这个问题有所了解吗?

1 个答案:

答案 0 :(得分:-1)

$sql = "INSERT INTO  clubevent (clubevent_id ,club_id ,event_id ,theme_id ,clubevent_date ,clubevent_start_time ,clubevent_finish_time ,clubevent_cost) VALUES (NULL , ' $clubstate',  '$eventstate',  '$themestate',  '$datestate',  '$sTimestate',  '$fTimestate',  '$coststate')";