Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 用户在线购买产品时向表中插入datetime的Sql查询_Mysql - Fatal编程技术网

Mysql 用户在线购买产品时向表中插入datetime的Sql查询

Mysql 用户在线购买产品时向表中插入datetime的Sql查询,mysql,Mysql,SQL查询,用于在用户在线购买产品时将日期时间插入表中。 在我的项目中,我想确定用户购买在线产品时的数据和时间 insert into prod_ordr (order_date, order_time) values (current_date(), current_time()) select c.buyer_id, p.comp_name, p.usr_address, p.city, p.state,

SQL查询,用于在用户在线购买产品时将日期时间插入表中。 在我的项目中,我想确定用户购买在线产品时的数据和时间

    insert into prod_ordr (order_date, order_time) values (current_date(), current_time())
      select
      c.buyer_id,
      p.comp_name,
      p.usr_address,
      p.city,
      p.state,
      p.pincode,
      p.contact_one,
      c.prod_id,
      c.qty,
      c.prod_barter_val

      from add_to_cart c join usr_profile p
      on c.buyer_id = p.usr_id
      where p.usr_email ='sunny@yahoo.com';

您只需使用now()即可执行此操作,我们可以显示当前时间和日期,但每次执行查询时,我们都会更改当前日期和时间。我想在用户购买产品时确定日期和时间。我正在尝试此代码