Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/06/2013, 19:35
Avatar de andresbetancourt
andresbetancourt
 
Fecha de Ingreso: julio-2008
Ubicación: colombia
Mensajes: 334
Antigüedad: 15 años, 10 meses
Puntos: 2
duda sobre fecha en mysql

buenas noches,

espero que estén bien, tengo el siguiente código SQL y me está generando error lo que está en color rojo, me podrían ayudar por favor? de antemano muchas gracias

Código MySQL:
Ver original
  1. INSERT INTO `dbventas`.`tblvendedor` (`nombre`, `telefono1`, `telefono2`, `telefono3`,
  2. `direccion1`, `direccion2`, `email1`, `email2`, `password`, `ciudad`, `pais`, `fecha_caducidad`)
  3.  VALUES ('".$this->getnombre()."', '".$this->gettelefono1()."', '".$this->gettelefono2()."',
  4. '".$this->gettelefono3()."', '".$this->getdireccion1()."', '".$this->getdireccion2()."', '".$this->getciudad()."',
  5. '".$this->getpais()."', '".$this->getemail1()."', ".$this->getemail2().", ".$this->getpassword().",
  6. 'DATE_ADD(NOW(), INTERVAL 12 MONTH)')

también lo intengo hacer así:

Código MySQL:
Ver original
  1. SET @fecha_caducidad = select DATE_ADD(NOW(), INTERVAL 12 MONTH);
  2.  
  3. INSERT INTO `dbventas`.`tblvendedor` (`nombre`, `telefono1`, `telefono2`, `telefono3`, `direccion1`,
  4. `direccion2`, `email1`, `email2`, `password`, `ciudad`, `pais`, `fecha_caducidad`)
  5. VALUES ('".$this->getnombre()."', '".$this->gettelefono1()."', '".$this->gettelefono2()."',
  6. '".$this->gettelefono3()."', '".$this->getdireccion1()."', '".$this->getdireccion2()."', '".$this->getciudad()."',
  7. '".$this->getpais()."', '".$this->getemail1()."', ".$this->getemail2().", ".$this->getpassword().",
  8. '@fecha_caducidad');

pero tampoco me funciona.

lo que intento es guardar la fecha de seis meses más adelante a la fecha actual en que se inserta el registro.


el lenguaje que uso es php y los métodos get que ven en los dos querys en mysql, son funciones de encapsulamiento que tengo para los atributos de la clase.

de antemano muchas gracias por su colaboración.
__________________
http://tecnologiaco.com/