Perad Posted December 21, 2006 Share Posted December 21, 2006 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? Link to comment https://forums.phpfreaks.com/topic/31489-keep-date-the-same-when-i-edit-an-article/ Share on other sites More sharing options...
HuggieBear Posted December 21, 2006 Share Posted December 21, 2006 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]RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/31489-keep-date-the-same-when-i-edit-an-article/#findComment-145859 Share on other sites More sharing options...
Perad Posted December 21, 2006 Author Share Posted December 21, 2006 Thanks a lot, that did the trick :D Link to comment https://forums.phpfreaks.com/topic/31489-keep-date-the-same-when-i-edit-an-article/#findComment-145904 Share on other sites More sharing options...
HuggieBear Posted December 21, 2006 Share Posted December 21, 2006 No problem, don't forget to use the 'Solved' button on your post.RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/31489-keep-date-the-same-when-i-edit-an-article/#findComment-145915 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.