I get the fields but it does not perform the SQL query when updating I can not find the fault

0
class Noticias{
    private $id;
    private $titulo;
    private $noticia;

    public function __construct()
    {
        // Argumentos recibidos
        $a = func_get_args();
        // Número de argumentos recibidos
        $i = func_num_args();
        if (method_exists($this,$f='__construct'.$i)) {
            call_user_func_array(array($this,$f),$a);
        }
    }


    public function __construct1($id, $titulo, $noticia){


        $this->nombre=$nombre;

        $this->id=$id;
        $this->titulo=$titulo;
        $this->noticia=$noticia;

    }


    public function __construct2($titulo, $noticia){

        $this->titulo=$titulo;
        $this->noticia=$noticia;

    }
    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @return mixed
     */
    public function getTitulo()
    {
        return $this->titulo;
    }

    /**
     * @return mixed
     */
    public function getNoticia()
    {
        return $this->noticia;
    }

    /**
     * @param mixed $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * @param mixed $titulo
     */
    public function setTitulo($titulo)
    {
        $this->titulo = $titulo;
    }

    /**
     * @param mixed $noticia
     */
    public function setNoticia($noticia)
    {
        $this->noticia = $noticia;
    }     
}

Driver

function modificarNoticia()
{
    $modifi = new Noticias();

    $modifi->setTitulo($_POST['titulo']);
    $modifi->setNoticia($_POST['noticia']);


    $modifiNoticia = new NoticiasDb();
    $modifiNoticia->conectar();
    $modifiNoticia->actualizarN($modifi);
    $modifiNoticia->obtenerErrorSQL();
    $modifiNoticia->desconectar();


    require_once ("presentacion/Principal.php");

}

queryBd

 function actualizarN($modifi){
        $consulta="update noticia set noticia.titulo = ?, noticia.cuerpo=? where noticia.id = ?";

        $pre=$this->conexion->prepare($consulta);
        $pre->bind_param("ssi", $titulo, $cuerpo, $id);

        $titulo=$modifi->getTitulo();
        $cuerpo=$modifi->getNoticia();
        $id=$modifi->getId();
        $pre->execute();

    }

I pick up the values of the get but when executing the update query with the MVC it does not do it, it just makes me the whole route but without updating the data and I can not find the fault by any side aver if someone can help me, the failure is somewhere in the code that I copied here but I have no idea Thank you

php / html

<form action="index.php?presentacion=actualizado" method="POST">

<p>Titulo:<input type="text" name="titulo" value="<?php echo $datos->getTitulo()?>"></p>
<p>Cuerpo:<input type="text" name="noticia" value="<?php echo $datos->getNoticia();?>"></p>

    <input  type="submit" value="Actualizar Datos">
    
asked by user87592 19.05.2018 в 17:59
source

0 answers