You are here: PHP date returns wrong value ?? « PHP « IT news, forums, messages
PHP date returns wrong value ??

Posted by Michael Gale on 01/16/05 09:22

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация