Error when selecting data from the database with ajax [closed]

0

I'm doing several cases in my code, but when I enter the listar case and execute it on my localhost it fails and it throws me an error

  

Fatal error: Uncaught Error: Call to undefined method mysqli_result :: feth_object ()

my code in my case is as follows:

case 'listar':
        $rspta = $categoria->listar();

            $data = Array();
AQUI EL ERROR--->while ($reg = $rspta->feth_object()) {
                $data[] =  array(
                    '0' => $reg->idventa,
                    '1' => $reg->num_viaje,
                    '2' => $reg->fecha_hora,
                    '3' => $reg->cliente,
                    '4' => $reg->destino,
                    '5' => $reg->operador,
                    '6' => $reg->idoperador,
                    '7' => $reg->viatico,
                    '8' => $reg->caseta,
                    '9' => $reg->comision,
                    '10' => $reg->extras,
                    '11' => $reg->tipoOperacion,
                    '12' => $reg->noSoporte,
                    '13' => $reg->diesel,
                    '14' => $reg->sansion,
                    '15' => $reg->factura,
                    '16' => $reg->comprobaciones,
                    '17' => $reg->desgaste,
                    '18' => $reg->total,
                    '19' => $reg->utilidad
                    );
            }
            $results = array(
                "sEcho"=>1, //INFORMACION PARA EL DATATABLE
                "iTotalRecords" => count($data), //ENVIAMOS EL TOTAL DE REGISTROS AL DATATABLE
                "iTotalDisplayRecords" => count($data), //ENVIAMOS EL TOTAL DE REGISTROS A VISUALIZAR
                "aaData" => $data
                );
            echo json_encode($results);
        break;  
    
asked by Cesar Gutierrez Davalos 01.07.2017 в 09:55
source

1 answer

2

The error call to undefined method means that you tried to call a function that does not exist.

If you change feth_object () by fetch_object () should work.

Manual: link

    
answered by 01.07.2017 / 10:37
source