On Tue, 6 Feb 2001 10:03, Chad Guilette wrote:
> I'm currenly having a problem with a timestamp field I have on my message
> board...each message is given a timestamp and stored in a table...heres
> the basic form of the insert...
>
> $time_added=date("Y m d H i s A");
>
> $str = "INSERT INTO topic ( num_id, user, quote, subject, ip,
> message_icon, page, post_id, thread_page, forum_num, time_added) VALUES
> (\"$comment_id\", \"$user[0]\", \"$quote\", \"$subject\", \"$ip\",
> \"$message_icon\", 0, \"$new_post_id[0]\", \"$thread_page_num\", \"$f\",
> \"$time_added\")"; $result = mysql_query($str);
>
> $time_added is a timestamp field in my MySQL table
Here is the reason - please see the mysql docs about the behaviour of a
timestamp field, particularly how it is automatically updated if, among
other circumstances, "the column is not specified in an insert ...
statement"
You may need a datetime type which doesn't auto-update.
>
> this works fine...
>
> But in the adminstrative tools im setting up, if i edit the post and
> resubmit the time is updated to the current time. Heres the admin code i
> use to update the post...t, transaction, is the unique field for each
> post so I use it to pull up the post..the body of the post is in a
> textarea (name=editpost) and i change it as needed and submit it which
> directs the script to the following block of code:
>
> $editpost = addslashes($editpost);
> $insertion = "update topic set quote=\"$editpost\" where
> transaction=\"$t\"";
> $insertion_query = mysql_query($insertion);
>
> The post is updated fine but the time is changed as I stated...Now I know
> I could pull the time_added field out and assign it to a separate
> variable and re-insert it when im updating but I'm curious as to why this
> would be happening...These are the only places where any modifications
> are made to the posts...on insertion and admin modification so I'm
> stumped as to what could be happening.
>
> Any ideas or suggestion,
>
> Regards,
> Chad Guilette
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]