Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2006
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question The date 0000-00-00 00:00:00

    Code:
    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
    Last edited by winpeace; 11-14-2006 at 11:31 AM. Reason: edit

  • #2
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    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'

  • #3
    New Coder
    Join Date
    Nov 2006
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    You need to change it to
    PHP Code:
    $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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •