...

View Full Version : The date 0000-00-00 00:00:00



winpeace
11-14-2006, 10:28 AM
function saveComment($database, $tmpl) {

global $my, $mosConfig_offset, $maxLanguage, $mosConfig_live_site, $mainframe;

$maxConfig = new maxConfig();

$row = new mosComment($database);
$_contentid = mosGetParam($_POST,'contentid','');
$row->bind($_POST);
$comment =$row->comment;
$comment = addslashes($comment);
$row->comment = $comment;
$row->myid = $my->id;
$row->state = $maxConfig->auto_publish;
$row->approved = $maxConfig->auto_approve;
$row->ip = mosGetParam($_SERVER,'REMOTE_ADDR','');
$row->browser = mosGetParam($_SERVER,'HTTP_USER_AGENT','');
$zone=3600*3;
$d = gmdate( "D M Y H:i", time() + $zone);
$row->date = gmdate( "D M Y H:i", time() + $zone);
$row->store();
$tmpl->addVar("emailcomment", 'date', $d);

$subject = $maxLanguage->EMAIL_SUBJECT_ADMIN_ALERT;

$tmpl = new patTemplate();
$tmpl->setBasedir("components/com_combomax/templates/");
$tmpl->setNameSpace('pxt');
$tmpl->readTemplatesFromFile("showcomment.tpl");
$tmpl->addVar("emailcomment", "NAME", stripslashes(stripslashes($row->name)));
$tmpl->addVar("emailcomment", 'email', stripslashes($row->email));
$tmpl->addVar("emailcomment", 'url', stripslashes($row->url));
$tmpl->addVar("emailcomment", 'comment', smile::smileReplace(stripslashes(stripslashes($row->comment))));
$tmpl->addVar("emailcomment", 'ip', stripslashes($row->ip));
$tmpl->addVar("emailcomment", 'browser', stripslashes($row->browser));
$tmpl->addVar("emailcomment", 'date', stripslashes($row->date));
$tmpl->addVar("emailcomment", 'reporturl', 'index.php?option=com_combomax&page=reportComment&commentid='.$row->id.'');

$tmpl->addVar("emailcomment", 'livesite', $mosConfig_live_site);
$tmpl->addVar("emailcomment", 'template', $mainframe->getTemplate());

$tmpl->addVar("emailcomment", 'contenttitle', getContentTitle($row->contentid));
$tmpl->addVar("emailcomment", 'linktocontent', $mosConfig_live_site.'/index.php?option=com_content&task=view&Itemid=1&id='.$row->contentid);

$tmpl->parseTemplate("emailcomment");
$message = $tmpl->getParsedTemplate("emailcomment");

the date seems 0000-00-00 00:00:00

NancyJ
11-14-2006, 01:23 PM
Your dates should be added in the format of 'YYYY-mm-dd HH:mm:ss'
ie. php date format 'Y-m-d H:i:s'

winpeace
11-14-2006, 01:40 PM
I change
$zone=3600*3;
$d = gmdate( "YYYY-mm-dd HH:mm:ss", time() + $zone);
$row->date = gmdate( "YYYY-mm-dd HH:mm:ss", time() + $zone);

but it isn't change

NancyJ
11-15-2006, 09:15 AM
You need to change it to


$zone=3600*3;
$d = gmdate( "Y-m-d H:i:s", time() + $zone);
$row->date = gmdate( "Y-m-d H:i:s", time() + $zone);

Take a look at http://uk2.php.net/manual/en/function.date.php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum