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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cormier at iwebgroup dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 21:01:31 2025 UTC