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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.