Skip to main content
Known Participant
June 7, 2006
Question

Datestamp

I have a column in a MySQL database:

datestamp DATE

I am using Dreamweaver 8 with PHP and trying to use the insert record form. When it inserts the record, it does not record the date. That's probably because it says 'datestamp' does not get a value. How do I get it to have a value without make a new form field for it?
This topic is closed to new replies. Start a new post to keep the conversation going.

4 replies

Inspiring
June 8, 2006
I was in error, read Joe's post, much better advice.


Translate
Inspiring
June 8, 2006
On Wed 07 Jun 2006 06:55:47p, Eiolon wrote in
macromedia.dreamweaver.appdev:

> I have a column in a MySQL database:
>
> datestamp DATE
>
> I am using Dreamweaver 8 with PHP and trying to use the insert record
> form. When it inserts the record, it does not record the date.
> That's probably because it says 'datestamp' does not get a value. How
> do I get it to have a value without make a new form field for it?

Create it in the table - in MySQL 4.1, it should be a field type
"timestamp", and you probably shouldn't use the keyword DATE for the
name. Don't include anything on the form for it; when the record is
inserted, it will automatically get a value.

--
-- Table structure for table `eiolon`
--

CREATE TABLE `eiolon` (
`eTimeStamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update
CURRENT_TIMESTAMP,
`myTextField` text NOT NULL,
`myVarCharField` varchar(10) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

In your form, you'd only have inputs for `myTextField` and
`myVarCharField` fields.

http://dev.mysql.com/doc/refman/5.0/en/datetime.html
Translate
June 8, 2006
I have the same problem with ASP.NET is the answer the same. Hidden field not code?
Translate
Inspiring
June 8, 2006
> because it says 'datestamp' does not get a value. How do I get it to have
> a
> value without make a new form field for it?

You don't. You will have to create a new field, and simply put in today's
date (ie, set the form field's avlue to a timestamp)

If you don't want it to be visible, then just use a hidden field.


<input type="hidden" value="<?php echo $date ?>">

http://us2.php.net/date

HTH,

Jon


Translate