PHP Classes

mysql date formatting

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  mysql date formatting  
Subject:mysql date formatting
Summary:Incorrect date value
Messages:3
Author:Paul Beaudoin
Date:2021-11-22 00:45:48
Update:2024-05-24 08:14:39
 

  1. mysql date formatting   Reply   Report abuse  
Picture of Paul Beaudoin Paul Beaudoin - 2021-11-22 00:45:48

I am getting the above error when applying this statement using php:
$query = "insert into xxxsbr.bnk_tmp set Account = '".$wacct."',Date='".$msdate."',Reference ='".$msref."',Amount='".$msamt."',Category='".$mscat."'";

Which translates to this:

insert into xxxsbr.bnk_tmp set Account = 'HCJN',Date='2021-11-15',Reference ='xxx-AUTHPBPYEFZEFT',Amount='-146.36',Category=''

and it fails in the php code with 'Incorrect Date Value' in the Date field.

It looks correct to me and if I cut and paste it into the MYSQL console, it works.

This should be simple and it escapes me.

Can someone please point me in the right direction?

Some detail:
This is under WAMPServer, Windows 10. PHP 7, MYSQL 5. All up to date.


Many thanks

Paul





There are 2 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.