[#] hm X_Shell Backd00r [#]
<?php
require_once 'Conexion.php';
class Noticias{
private $id_noticia;
private $titulo;
private $contenido;
private $imagen_noticia;
private $fecha_creacion;
const TABLA = 'noticias';
public function __construct($id_noticia=null, $titulo=null, $contenido=null, $imagen_noticia=null, $fecha_creacion=null){
$this->id_noticia = $id_noticia;
$this->titulo = $titulo;
$this->contenido = $contenido;
$this->imagen_noticia = $imagen_noticia;
$this->fecha_creacion = $fecha_creacion;
}
public function setId_noticia($id_noticia){
return $this->id_noticia = $id_noticia;
};
public function setTitulo($titulo){
$this->titulo = $titulo;
};
public function setContenido(){
$this->contenido = $contenido;
};
public function setImagen_noticia(){
$this->imagen_noticia = $imagen_noticia;
};
public function setFecha_creacion(){
$this->fecha_creacion = $fecha_creacion;
};
public function guardar(){
$conexion = new Conexion();
$consulta = $conexion->prepare(' INSERT INTO'.self::TABLA.'(id_noticia,titulo,contenido,imagen_noticia,fecha_creacion)VALUES(:id_noticia,:titulo,:contenido,:imagen_noticia,:fecha_creacion)');
$consulta = bindParam(':id_noticia', $this->$id_noticia);
$consulta = bindParam(':titulo', $this->$titulo);
$consulta = bindParam(':contenido',$this->$contenido);
$consulta = bindParam(':imagen_noticia',$this->$imagen_noticia);
$consulta = bindParam(':fecha_creacion',$this->$fecha_creacion);
};
}
?>
Mr.hm X_Shell Backd00r 1.0, Coded By Mr.hm X_Shell Backd00r