Codeigniter- Query in the database always returning null

0

The getlocal function that is a query in the database is always returning null even after I do an insert in the database

file denuncia_model.php

class denuncia_model extends CI_Model {
function __construct(){
    parent::__construct();

}
public function insertlocal($local){
    $insertquery = "INSERT INTO local(estado,lng,lat) VALUES (?,?,?)";
    $this->db->query($insertquery,$local);
}
public function getlocal($local){
    $queryteste = "SELECT * FROM local WHERE estado = ? AND lng = ? AND lat = ?";
    $query = $this->db->query($queryteste,$local);
    $row = $query->row_array();
    $id = $row['id'];
    return $id;

}
public function insertdenuncia($denuncia){
    $insertdenunciaquery = "INSERT INTO denuncias(descricao,data,forma,genero,preconceito,idade,id_local) VALUES (?,?,?,?,?,?,?)";
    $this->db->query($insertdenunciaquery,$denuncia);

}

}

    $local = array($estado,$lng,$lat);
        $denuncia = array($descricao,$data,$agressao,$gender,$preconceito,$age);
        $this->denuncia_model->insertlocal($local);
        $id = $this->denuncia_model->getlocal($local);
        array_push($denuncia,$id);
        $this->denuncia_model->insertdenuncia($denuncia,$local);

    
asked by anonymous 17.11.2018 / 02:27

0 answers