PHP date returns wrong value ??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have a web page that loads php code from another file using include, the second file calls a function from a third file after doing a include on it.

I am running php 4.3.7

Below is the snip of code that gets called to update the database. The problem is with the tentry_time value.

The part of the code:
$query .= " tentry_time = '" . date("H:j:s") . "',";

For some reason ... the value for seconds is always off, if I do a update, then another one right way, the value that gets stored in the database for the second entry will occure before the first according to the number of seconds.

Here is some data from the DB after a select statement, you can see that the times do not follow the auto-increment value (first field).
26 | 15 | 2005-01-15 | 23:15:27 | 1 | 90 | Testing updates |


27 | 15 | 2005-01-15 | 23:15:33 | 1 | 90 | Another update ... |

28 | 15 | 2005-01-15 | 23:15:07 | 1 | 90 | Testing a 4 entry


--snip--
if (($_POST) AND (isset($_POST['newentry']))) {
$check=0;
if ($_POST['ticket_id'] != $ticket) {
$check=1;
$status="<li class=error>ERROR -- YOU DO NOT HAVE ACCESS TO THIS TICKET !!!!!</li>\n";
}


if ($check==0) {
$query="INSERT INTO tentry_table SET ticket_id = '" . $ticket . "',";
$query .= " tentry_date = '" . date("Y-m-d") . "',";
$query .= " tentry_time = '" . date("H:j:s") . "',";
$query .= " tentry_rep = '" . $_SESSION['userid'] . "',";
if ((isset($_POST['tentry_ctime'])) AND $_POST['tentry_ctime'] > 5 and $_POST['tentry_ctime'] < 90) {
$query .= " tentry_ctime = '" . mysql_real_escape_string($_POST['tentry_ctime']) . "',";
} else {
$query .= " tentry_ctime = '90',";
}
if ((isset($_POST['tentry_body'])) AND strlen($_POST['tentry_body']) > 5) {
$query .= " tentry_body = '" . mysql_real_escape_string($_POST['tentry_body']) . "'";
} else {
$status="<li class=error>ERROR with entry -- appears to be empty !!!!!</li>\n";
$check=1;
}
--snip--



Anyone have any ideas ??

Michael.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux