Page 1 of 1

[SOLVED]Preventing TIMESTAMP from updating

Posted: Sat Oct 01, 2005 4:19 am
by blacksnday
When you have rows that use a Timestamp, how do you stop it
from updating the date when the row is updated?

I know if using something like phpMyAdmin you just unselect the timestamp field,
but my question concerns when writing an update/edit script for a website-based admin.

The current update query I am using in my script is

Code: Select all

$query="UPDATE news  SET name='$ud_first', news='$ud_last' WHERE id='$ud_id'";
Would something like

Code: Select all

$query="UPDATE news  SET name='$ud_first', news='$ud_last', date='' WHERE id='$ud_id'";
work to stop the timestamp from changing when being updated?
well, scratch that... doing it that way results in an empty timestamp.

hmm.. how to update and keep the timestamp the same as the original?

Posted: Sat Oct 01, 2005 4:38 am
by blacksnday
I got it fixed :)

Just added stuff needed to pull the date from the database then insert when updated
and no more changing timestamps !

Posted: Sat Oct 01, 2005 7:14 am
by feyd
you don't even have to select the timestamp.. simply setting it to itself during the update will keep it in the original form.