javascript – Undefined method mysqli_result, stuck in this error

Questions:

I’m trying to learn PHP, AJAX, JS, etc.
I am trying to make a sales system, I am following some tutorial videos step by step, but I am stuck in this error and I am not able to solve on my own.

This is the error that appears to me:

Fatal error: Uncaught Error: Call to undefined method mysqli_result::fetch_objet() in C:\xampp\htdocs\sistema\ajax\categoria.php:45 Stack trace: #0 {main} thrown in C:\xampp\htdocs\sistema\ajax\categoria.php on line 45

This is my code:

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

    while($reg=$rspta->fetch_objet()) 
    {
        $data[]=array(
            "0"=>$reg->idcategoria,
            "1"=>$reg->nombre,
            "2"=>$reg->descripcion,
            "3"=>$reg->condicion
            );
    }
    $results = array(
        "sEcho"=>1, //Information for Datatable
        "iTotalRecords"=>count($data), //send the total records to the datatable
        "iTotalDisplayRecords"=>count($data), // send the total records to the datatable to show
        "aaData"=>$data);
    echo json_encode($results);

My 45 line is: while($reg=$rspta->fetch_objet())

I’m almost sure I wrote it well, I checked it many times

Sorry i don’t have the best english

How to&Answers:

Looks like you misspelt “object”, missing the “c”.

Leave a Reply

Your email address will not be published. Required fields are marked *