Jump to content

[SOLVED] MySQL datetime VS. PHP date() problem?


plodos

Recommended Posts

sql table

CREATE TABLE IF NOT EXISTS `paper` (
  `id` int(11) NOT NULL auto_increment,
  `title` text collate latin1_general_ci NOT NULL,
  `abstract` text collate latin1_general_ci NOT NULL,
  `keywords` varchar(50) collate latin1_general_ci NOT NULL,
  `authors` varchar(50) collate latin1_general_ci NOT NULL,
  `status` varchar(50) collate latin1_general_ci NOT NULL,
  `ext` text collate latin1_general_ci NOT NULL,
  `user` int(11) NOT NULL,
  `statustext` varchar(50) collate latin1_general_ci NOT NULL,
  `datum` datetime NOT NULL,
  `comment` text collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

 

I have query and result is true

$now = time();
$date = date("d-m-Y H:i:s",$now);

$q		= "insert into paper set title='{$_REQUEST['title']}', abstract='{$_REQUEST['abstract']}', 
keywords='{$_REQUEST['keywords']}',  authors='{$_REQUEST['authors']}', ext='$file_ext', user='{$_SESSION['id']}',
status='new', datum='$date' ";

output is :

insert into paper set title='aaaaaaaa', abstract='aaaaaaaa', keywords='aaaaaaaa', authors='aaaaaaaa', ext='.doc', user='20', status='new', datum='25-12-2008 18:49:06'

 

But when I check my PHPmyADMIN, i cant see my datum variable, the field is 000000000 there is no time, WHY?

 

datum (field)

0000-00-00 00:00:00

0000-00-00 00:00:00

0000-00-00 00:00:00

0000-00-00 00:00:00

0000-00-00 00:00:00

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.