dousong1926 2013-07-30 14:21
浏览 29
已采纳

PHP / SQL语法错误1064

I'm new to PHP so bear with me.

This is the code for entering into a bookings table on my site:

http://pastie.org/8190189

And this is the error I get when I enter data into a form on the front end of the site:

http://pastie.org/8190194

I've been working at it for hours but I can't get anywhere.

I thought the problem may be with the:

SELECT u_id FROM `joom_hl_puser_role` WHERE pid = '1'

The table puser_role just connects joomla users to hotels that they can manage on the site. (I want to enter the hotel manager's joomla user number to the table).

but I'm sure that the syntax is correct.

Thanks for your help.

  • 写回答

2条回答 默认 最新

  • douqi3913 2013-07-30 14:41
    关注

    The problem is your use of TIME();

    TIME needs a parameter passed.

    mysql> select TIME();
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
    

    Change it to

    TIME(NOW())
    

    From the MySQL manual for TIME

    TIME(expr)

    Extracts the time part of the time or datetime expression expr and returns it as a string.

    This function is unsafe for statement-based replication. Beginning with MySQL 5.5.1, a warning is logged if you use this function when binlog_format is set to STATEMENT. (Bug #47995)

    mysql> SELECT TIME('2003-12-31 01:02:03');
             -> '01:02:03' 
    
    mysql> SELECT TIME('2003-12-31 01:02:03.000123');
             -> '01:02:03.000123'
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥15 关于超局变量获取查询的问题
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集
  • ¥15 在启动roslaunch时出现如下问题
  • ¥15 汇编语言实现加减法计算器的功能