Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wrong Date Since Jan 1,2006 - 12/29/1899

Status
Not open for further replies.

msdbsql

Technical User
Nov 22, 2004
39
0
0
US
The date in the USERS table shows 12/29/1899(last_modified_date) when the registration script is used to create a new user. I copied my registration.php script ran it on another hosting site along with the exported USERS table and it captured the right date. I have contacted my hosting source and they don't beleive it is a problem on their end. Have I missed something here?
 
The problem might be in the php script, or it might be in the SQL statements, or it might be in the version or configuration of the php processor on the host or it might be a wrong date on the host. Usually my problems are in my script, much as I like to blame them on system administrators. You may wish to post your php and sql code here for more help.
 
Is your last_modified_date a date type field or varchar?

Can you show the insert? Hard for us to guess a solution to your problem if you have given us nothing to go on.
 
Yes I can include some additional information. I wanted to mention that using this table and registration.php script on another hosting site I cannot duplicate this problem; last modified date is correct.

This is the field in question from the USERS table.
`last_modified` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'

It is a timestamp field so it is not directly updated by a script. The only date that is inserted by the script is reg_date and that date is correct. last_modified is not inserted based on the script.

This is the insert statement used by registration.php

$now=date('YmdHis');
"INSERT INTO users (name_first,name_last,company_name,address,address2,city,state,zip,phone_number,email_address,user_name,password,reg_type,reg_date) VALUES ('"
.$first ."','"
.$last ."','"
.$company ."','"
.$addr1 ."','"
.$addr2 ."','"
.$city ."','"
.$state ."','"
.$zip ."','"
.$phone ."','"
.$email ."','"
.$uname ."','"
.$pass1 ."','"
.$type ."','"
.$now ."')";
 
You may wish to read the information about TIMESTAMP here


I noted this which surely sounds like differences between the hosts could explain the problem.

"The TIMESTAMP data type has varying properties, depending on the MySQL version and the SQL mode the server is running in. These properties are described later in this section.
 
Precisely my dear Watson. The version of MYSQL is different on the host. So that is why it worked everywhere else. They finally acknowledged that today. In fact they are also running different versions of phpmyadmin. I have multiple websites and they are using at least 2 different versions.

This host requires an additional attribute: ON UPDATE CURRENT_TIMESTAMP for the TIMESTAMP field and a checkbox(X) Current Time Stamp (shown in phpmyadmin); this was not the case last year. So when they updated this year; this field no longer functioned properly.

I should have stuck to my original thought to pursue the hosting site further regarding this issue. Thanks for your assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top