Data view php mysqli

0

I have a problem showing the data in the view, I mean, I have a data modification form, which edit and update the data in the database without problems, but when I return to the view to show all the data data of the table, it does not show me any of the previously edited ones (it is worth clarifying: if the edited data is stored in the db and it only shows me the data that it inserts from the sql script), neither when I give it to update, nor refreshing the server. I'm doing a POO MVC web with PHP and mysqli. Something that is doing wrong ?? It is this table to which I made the query.

CREATE TABLE estudiante (
    rude VARCHAR(20) PRIMARY KEY,
    nombres VARCHAR(50) NOT NULL,
    apellidos VARCHAR(50) NOT NULL,
    telefono VARCHAR(30),
    grado ENUM('1', '2', '3', '4', '5', '6') NOT NULL,
    paralelo ENUM('A', 'B') NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=UTF8;
/* --------------------------*/

and I have another assistance table:

CREATE TABLE asistencia (
asistencia_id INT PRIMARY KEY AUTO_INCREMENT,
fecha_asistencia DATE NOT NULL,
tipo_asistencia ENUM('P','F','A','L') NOT NULL,
rude VARCHAR(20),
CONSTRAINT FOREIGN KEY (rude) REFERENCES estudiante(rude)
    ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=UTF8;

To update the data I use the following query:

REPLACE INTO estudiante SET 
        rude = '$rude', 
        nombres = '$nombres', 
        apellidos = '$apellidos',
        telefono = '$telefono', 
        grado = '$grado', 
        paralelo = '$paralelo'

To obtain the data to the db use the following:

public function get( $es = '' ) {

    $this->query = ($es != '') 
        ?"SELECT es.rude, es.nombres, es.apellidos, es.telefono, es.grado, es.paralelo
        FROM estudiante as es
        INNER JOIN asistencia as a
        on es.rude = a.rude
        WHERE es.rude = '$es' ORDER BY es.rude ASC"
        :"SELECT *
        FROM estudiante as es
        INNER JOIN asistencia as a
        on es.rude = a.rude";

    $this->get_query();

    $num_rows = count($this->rows);

    $data = array();

    foreach ($this->rows as $key => $value) {
        array_push($data, $value);
    }

    return $data;
}
    
asked by JoseMa Zubieta 10.09.2018 в 04:33
source

0 answers