Ver Mensaje Individual
  #9 (permalink)  
Antiguo 02/05/2014, 09:12
quico5
 
Fecha de Ingreso: enero-2008
Mensajes: 580
Antigüedad: 16 años, 3 meses
Puntos: 9
Respuesta: Fechas en PHP con posible formato incorrecto

ya estoy cerca, sigo buscando

Debuelve la fecha
Código PHP:
echo $this->getTexto('fecha');exit;

                
//if (!$this->getTexto($this->_objRequest->getControlador())) {
                
if (!$this->getTexto($this->_objRequest->getControlador(), false)) {//false permite añadir html
                    
$this->_view->_error 'Debe introducir la noticia';
                    
$this->_view->renderizar($this->_view->metodo$this->_view->controlador);
                    exit;
                }

                
$this->_noticia->insertarNoticia(
                    
$this->getNoticiaParam('titulo'),
                    
$this->getNoticiaParam('fecha'),
                    
$this->getNoticiaParam($this->_objRequest->getControlador())
                ); 
Devuelve la noticia en lugar de la fecha
Código PHP:
        public function insertarNoticia($titulo$noticia$fecha) {
            echo
$fecha implode("-"array_reverse(explode("-"$fecha)));exit;
            
$this->_db->prepare(
                
"INSERT INTO noticias VALUES (null, :titulo, :noticia, :fecha)"
            
)->execute(array(':titulo' => $titulo':noticia' => $noticia':fecha' => $fecha));
        }