This is the code that generates the query of the entire table
$sql = "SELECT * FROM mitabla";
$query = mysqli_query($con, $sql) or die (mysqli_error($con));
$item = 0;
while($row = mysqli_fetch_array($query)){
$item = $item+1;
}
This is the code that generates the query of the entire table
$sql = "SELECT * FROM mitabla";
$query = mysqli_query($con, $sql) or die (mysqli_error($con));
$item = 0;
while($row = mysqli_fetch_array($query)){
$item = $item+1;
}
There are several libraries in PHP to generate pdf documents.
With link for example, it would be as simple as the following code:
<?php
require('fpdf.php');
$con = new mysqli("localhost", "my_user", "my_password", "my_db");
/* verificar la conexión */
if (mysqli_connect_errno()) {
printf("Falló la conexión: %s\n", $mysqli->connect_error);
exit();
}
$x = $y = 10; // Inicializamos x e y
$pdf = new FPDF(); // Creamos el objeto pdf
$pdf->AddPage(); // Añadimos la primera página
$pdf->SetFont('Arial','B',16); // Seleccionamos el tipo de fuente
$pdf->SetXY($x,$y); // Vamos a la posición x=10, y=10
$sql = "SELECT * FROM mitabla";
$query = mysqli_query($con, $sql) or die (mysqli_error($con));
$item = 0;
while($row = mysqli_fetch_array($query))
{
$pdf->Cell(40,10,$row[1]); // Imprimimos el resultado del primer campo
$y = $y + 10; // Bajamos la posición en 10 puntos
$pdf->SetY($y); // para escribir la siguiente línea
$item = $item+1;
}
$pdf->Output();
?>
You should give us some more information to know what you are working with, but I would recommend FPDF, it is a very good library, we use it and you learn how to use it (it is very simple), you generate very good PDFs.
I leave here the link to your website link