plodos Posted December 26, 2008 Share Posted December 26, 2008 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 https://forums.phpfreaks.com/topic/138430-solved-mysql-datetime-vs-php-date-problem/ Share on other sites More sharing options...
revraz Posted December 26, 2008 Share Posted December 26, 2008 Because your format datum='25-12-2008 18:49:06' is wrong, you need to enter the date as shown. YYYY-MM-DD HH:MM:SS Link to comment https://forums.phpfreaks.com/topic/138430-solved-mysql-datetime-vs-php-date-problem/#findComment-723797 Share on other sites More sharing options...
plodos Posted December 26, 2008 Author Share Posted December 26, 2008 revraz, you know what are you doing i dont know how many times you solved my problems thank you one more time Link to comment https://forums.phpfreaks.com/topic/138430-solved-mysql-datetime-vs-php-date-problem/#findComment-723803 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.