Re: HOW update time and date-fields to mysql....
| From: | matt stone | Date: | Tue, 28 Feb 2006 12:48:39 +0000 |
| Subject: | Re: HOW update time and date-fields to mysql.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231197@lists.php.net to get a copy of this message | ||
On 2/28/06, Gustav Wiberg <gustav@varupiraten.se> wrote:
>
> Hi there guys!
>
> I have used a date-field and a time-field in a mysql-database.
>
>
>
>
> $sql = "UPDATE tbforum SET";
> $sql .= " question=" . safeQuote($frmQuestion);
> $sql .= ", insertDate='" . $dat . "'";
> $sql .= ", insertTime='" . time() . "'";
> $sql .= " WHERE IDForum=" . safeQuote($idForum);
> $querys = mysql_query($sql);
Use NOW() for both your date and time fields if the fields have been set up
as that. MySQL will then add the date and time according to whatever those
values are on your db machine.
Cheers
Matt