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?
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.