Jump to content

Keep date the same when i edit an article?


Perad

Recommended Posts

When i create a news article for my site i have the following code mysql query.

[code]$query = "INSERT INTO news(postdate, title, newstext, cat_id, author, author_id) VALUES(NOW(), '$t', '$c', '$a_cat', '$username', '$user_id')";[/code]

When i edit a news article i have the following query.

[code]$query = "UPDATE news SET title='$t', newstext='$c' WHERE id='$id'";[/code]

Yet it always changes the postdate as well. Is there a way in which i can update my mysql table without the postdate column being updated as well?
Sounds as though it's a timestamp field, change the column type to datetime.

Taken from the MySQL Manual...

[quote]
The first TIMESTAMP column in table row automatically is updated to the current timestamp when the value of any other column in the row is changed...[/quote]

Regards
Huggie

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.