duannei0044 2017-02-16 07:37
浏览 927

查看与您的MySQL服务器版本相对应的手册,以便在第1行的“07:28:29”附近使用正确的语法

I wanna insert record to MySQL but it returns error :

check the manual that corresponds to your MySQL server version for the right syntax to use near '07:28:29)' at line 1

I use PHP for connecting to database. here is what i write :

$id = 353567452;
$firstname = "My_name";
$username = "@myusername";
$message_date = "2017-01-01 17:29:20";
$sql_check = "SELECT id, firstname, username, register_date FROM RJ_userino WHERE id=" . "$chat_id AND firstname=$firstname AND username=$username AND register_date=$message_date";
            $sql_insert = "INSERT INTO RJ_userinfo (id, firstname, username, register_date) VALUES (" . "$chat_id, $firstname, $username, $message_date)";
            $check = $db_req->query($sql_check);
            if ($check->num_rows == 0){
                $db_req->query($sql_insert);
            }

And here is my column info : enter image description here

where is the problem ?

  • 写回答

1条回答 默认 最新

  • dooo61733 2017-02-16 07:42
    关注

    $message_date should be a timestamp which is number eg. 1487230853

    u can use the php function strtotime();

    $message_date = strtotime("2017-01-01 17:29:20");
    
    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)