ID: 29381 Updated by: [EMAIL PROTECTED] Reported By: dj at cleancode dot org -Status: Open +Status: Bogus Bug Type: MySQL related Operating System: Red hat 9 PHP Version: 4.3.8 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Please read http://dev.mysql.com/doc/mysql/en/Date_and_time_type_overview.html and http://www.php.net/time Previous Comments: ------------------------------------------------------------------------ [2004-07-26 01:03:42] dj at cleancode dot org Description: ------------ When using mysql_query(), I can not insert a specific line into MySQL. However, if I have PHP echo the string I'm trying to insert into the database, and then copy and paste it into the mysql command line tool, it inserts fine. Reproduce code: --------------- $conn = mysql_connect("localhost", "organizer", "organizer") or die("Can't connecto to DB" . mysql_error()); mysql_select_db("Organizer") or die("Can't change DB: " . mysql_error()); $currdate = time(); if ($taskarr['closed'] != "") $closed_date = $currdate; else $closed_date = 0; /* insert into database. */ $q = "INSERT INTO Tasks SET post_date = $currdate, closed_date = $closed_date, last_edit = $currdate, subject = '" . $taskarr['subject'] . "', body = '" . $taskarr['body'] . "';"; echo "$q<BR><BR>"; mysql_query($q) or die("Couldn't insert data: " . mysql_error()); mysql_close(); Expected result: ---------------- The data should get inserted in the table Actual result: -------------- Doing a SELECT * FROM Tasks; shows nothing in the DB. After performing this, mysql_query() returns fine... No error from mysql_error() since mysql_query() does not return false. To make matters more interesting, if I statically set $currdate, it works. For instance: $currdate = 1090793160; The data gets inserted into the database properly. It seems if I use time() or mktime() cause the issue... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29381&edit=1