php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8939 Date problem with MySQL
Submitted: 2001-01-26 10:40 UTC Modified: 2001-01-26 11:40 UTC
From: cormier at iwebgroup dot com Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0.4pl1 OS: Linux
Private report: No CVE-ID: None
 [2001-01-26 10:40 UTC] cormier at iwebgroup dot com
./configure --with-mysql=/mysql --enable-bcmath --with-gd 
            --with-xml --with-imap --with-dbm 
            --with-apxs=/apache/bin/apxs


The code before update:
  $today = date("Y-m-d H:i:00");
  $requete = "insert into table (id, date) VALUES (NULL, \"$today\")";
  $resultat = mysql_query($requete);

The result: 
  = 0000-00-00 00:00:00

After some modification:
  $requete = "insert into table (id, date) VALUES (NULL, now())";
  $resultat = mysql_query($requete);

The result: 
  = 2001-01-25 19:38:24

Conclusion:
  I think there are a incompatibility with de date format
  of mysql. I use mysql-3.23.32.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-26 11:40 UTC] rasmus@php.net
Why did you put quotes around $today and not around now() ?  And if quotes are needed at all, surely they should be single quotes.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 07:01:28 2024 UTC