I'm doing a project in which data is sent using a PHP form to a MariaDB database. I would like to suggest how to show the table with the data of the database as a report and show the image that was stored in the images
folder.
The script for the table is as follows:
<?php
$conexion=mysqli_connect(
'localhost',
'root',
'',
'INVENTARIO'
);
if($conexion==FALSE) {
echo('Error en la conexión');
exit();
}
$resultado=mysqli_query(
$conexion,
'SELECT*FROM CONTRALORIA'
);
if ($resultado==FALSE){
echo('Error en la consulta.');
mysqli_close($conexion);
exit();
}
?>
<table border="4" bgcolor = "#D6EEE2" >
<tr>
<th>Número de Inventario</th>
<th>Descripción del Bien</th>
<th>Número de Serie</th>
<th>Marca</th>
<th>Modelo</th>
<th>Color</th>
<th>Area</th>
<th>Condición</th>
<th>Fecha</th>
<th>Fondo</th>
<th>Cuenta</th>
<th>Valor Factura</th>
<th>Valor Actual</th>
<th>Fotografía</th>
</tr>
<?php
while($fila =
mysqli_fetch_row($resultado)) {
printf('<tr>');
printf(
"<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>",
$fila[0], $fila[1], $fila[2] , $fila[3], $fila[4], $fila[5] , $fila[6], $fila[7], $fila[8] , $fila[9], $fila[10], $fila[11] ,$fila[12], $fila[13]
);
printf('</tr>');
}
?>
</table>
<?php
mysqli_free_result($resultado);
mysqli_close($conexion);
?>
La ruta de la carpeta donde se almacenan los datos es la siguiente:
<img src="/Inventario/images/<?php echo $imagen; ?>" alt="" width="100px" />
This is the database:
MariaDB [INVENTARIO]> describe CONTRALORIA;
+----------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+-------+
| num_inventario | varchar(15) | NO | PRI | NULL | |
| desc_bien | varchar(30) | YES | | NULL | |
| num_serie | varchar(30) | YES | | NULL | |
| marca | varchar(30) | YES | | NULL | |
| modelo | varchar(30) | YES | | NULL | |
| color | varchar(30) | YES | | NULL | |
| area | varchar(30) | YES | | NULL | |
| condicion | varchar(30) | YES | | NULL | |
| fecha | varchar(10) | YES | | NULL | |
| fondo | varchar(15) | YES | | NULL | |
| cuenta | varchar(30) | YES | | NULL | |
| factura | int(11) | YES | | NULL | |
| actual | int(11) | YES | | NULL | |
| foto | varchar(250) | YES | | NULL | |
+----------------+--------------+------+-----+---------+-------+
Only the table appears but I can not get the data stored in the database displayed next to the images stored in the images
folder.
I would greatly appreciate your help!