i am making a report in php using fpdf but i get an error and i dont know how solve it

Viewed 46

Fatal error: Uncaught TypeError: Cannot access offset of type string on string in C:\xampp\htdocs\Expo\api\Reportes\instituciones.php:37 Stack trace: #0 {main} thrown in C:\xampp\htdocs\Expo\api\Reportes\instituciones.php on line 37

is the error

<?php 
if (isset($_GET['id'])) {
require('../helpers/dashboard_report.php');
require('../modelos/institucion.php');
require('../modelos/clientes.php');

$institucion = new institucion;
if ($institucion->setId($_GET['id'])) {
    if ($rowinstitucion = $institucion->readOne()) {
        $pdf = new Report;
        $pdf->startReport('Productos de la linea '.$rowinstitucion['tipo_insti']);
    
        $cliente = new clientes;
        if ($cliente->setInsti($rowinstitucion['id_insti'])) {
          
            if ($dataclientes = $cliente->clienteInstitucion()) {
            
                $pdf->setFillColor(80, 80, 200);
              
                $pdf->setFont('Times', 'B', 11);
                
                $pdf->cell(126, 10, utf8_decode('Nombre'), 1, 0, 'C', 1);
                $pdf->cell(30, 10, utf8_decode('Precio (US$)'), 1, 0, 'C', 1);
                $pdf->cell(30, 10, utf8_decode('existencias'), 1, 1, 'C', 1);
                
                $pdf->setFont('Times', '', 11);
      
                foreach ($dataclientes as $rowclientes) {
         line 37    $pdf->cell(126, 10,utf8_decode($rowclientes['nombre']), 1, 0);
                    $pdf->cell(30, 10,$rowclientes['nombre_cont'], 1, 0);
                    $pdf->cell(30, 10,$rowclientes['horario'], 1, 1);
                    
                }
            } else {
                $pdf->cell(0, 10, utf8_decode('No hay productos para esta categoría'), 1, 1);
            }
            $pdf->output('I', 'categoria.pdf');
        } else {
            //header('location: ../../../views/dashboard/categorias.php');
        }
    } else {
        //header('location: ../../../views/dashboard/categorias.php');
    }
} else {
    //header('location: ../../../views/dashboard/categorias.php');
}
} else {
//header('location: ../../../views/dashboard/categorias.php');
}
0 Answers
Related