Page 1 of 1

Date Problem in PHP?

Posted: Sat Mar 06, 2010 2:29 am
by adilmarwat2004
I have prove the query to the mysql table as

UPDATE info SET date_retire = date_retire+ 00600000;

which set the data of retirement of emplyees.

When i display the date_retire field on php page it give the wrong result as 01-01-1970 for each record on employee.

How can i achieve the desired date from field.

please help in this regard.

Adil

Re: Date Problem in PHP?

Posted: Sat Mar 06, 2010 3:54 am
by social_experiment
1. What type of value are you storing in the 'date_retire' field?
2. Are you updating ALL the fields in the database at once, or one at a time?
When i display the date_retire field on php page it give the wrong result as 01-01-1970 for each record on employee.
In the query you are not specifying a record to update. If you use 'UPDATE table SET field = value' it updates ALL records in the table. To update individual records you should use

Code: Select all

<?php $q = "UPDATE table SET field = $new_value WHERE id = $specific_id";
// or something similar depending on your table structure
?>