Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Datestamp

New Here ,
Jun 07, 2006 Jun 07, 2006
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?
TOPICS
Server side applications
372
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 08, 2006 Jun 08, 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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 08, 2006 Jun 08, 2006
I have the same problem with ASP.NET is the answer the same. Hidden field not code?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 08, 2006 Jun 08, 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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 08, 2006 Jun 08, 2006
LATEST
I was in error, read Joe's post, much better advice.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines