Below is the code of one of my reports
<?php
define('PREPEND_PATH', '../');
$hooks_dir = dirname(__FILE__);
include("$hooks_dir/../defaultLang.php");
include("$hooks_dir/../language.php");
include("$hooks_dir/../lib.php");
// Incluimos la librería FPDF
require('fpdf/fpdf.php');
// Conectamos a la base de datos
$con = mysqli_connect("localhost","demo","0651Vrsl.","demo");
// Obtenga el ID del usuario autenticado
$user_id = $_SESSION['user_id'];
// Realizamos la consulta de los miembros
$query = "SELECT * FROM clientes WHERE user_id = $currentUserID";
$result = mysqli_query($con, $query);
// Creamos el documento PDF
$pdf = new FPDF();
$pdf->AddPage();
// Agregamos el título del reporte
$pdf->SetFont('Arial','',12);
$pdf->Cell(190,10,'REPORTE DE CLIENTES',0,1,'C');
$pdf->Ln(2);
// Agregamos los encabezados de la tabla
$pdf->SetFont('Arial','B',8);
$pdf->Cell(20,5,'CEDULA',1,0,'C');
$pdf->Cell(40,5,'NOMBRE',1,0,'C');
$pdf->Cell(30,5,'FECHA',1,0,'C');
$pdf->Cell(80,5,'DETALLE',1,0,'C');
$pdf->Cell(20,5,'MONTO',1,1,'C');
$pdf->SetFont('Arial','',8);
// Agregamos los datos de los miembros
while ($row = mysqli_fetch_array($result)) {
$pdf->Cell(20,5,$row['CEDULA'],1,0,'C');
$pdf->Cell(40,5,$row['NOMBRE'],1,0);
$pdf->Cell(30,5,$row['FECHA'],1,0,'C');
$pdf->Cell(80,5,$row['DETALLE'],1,0);
$pdf->Cell(20,5,$row['MONTO'],1,1);
}
$pdf->Output();
?>
This report works if I remove the code "WHERE user_id = $currentUserID" some way to implement so that it works per logged in user, Thanks !!!