El llamado a mostrar todo en una web lo hago con este muestra_prueba.php
Código PHP:
<html>
<head>
<title>Download File From MySQL</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #84939A;
}
.Estilo5 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #CCCCCC; }
.Estilo10 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #FFFFFF; font-size: 12px; }
-->
</style>
</head>
<body>
<?
$connection=mysql_connect("www.*****.com","***","****")
or die("Error conectando a la base de datos");
$db=mysql_select_db("dbequipelsol",$connection)
or die ("Error seleccionando la base de datos");
$query = "SELECT * FROM equipos'";
$result = mysql_query($query) or die('Error, query failed');
if(mysql_num_rows($result) == 0)
{
echo "Database is empty <br>";
}
else
{
while(list($id, $sub_categoria, $nombre, $marca, $modelo, $n_serie, $precio, $descripcion) = mysql_fetch_array($result))
{?>
<table background="../JPG/fondo_tabla.jpg" width="750" border="0" cellspacing="0">
<tr>
<td width="17%"><span class="Estilo5">SUBCATEGORIA:</span></td>
<td width="42%"><span class="Estilo10"><?php echo "$sub_categoria";?></span></td>
<td width="41%" rowspan="8"> <img src="download.php?id=<?=$id;?>"><?=$thumb;?> <br></td>
</tr>
<tr>
<td><span class="Estilo5">NOMBRE:</span></td>
<td><span class="Estilo10"><?php echo "$nombre";?></span></td>
</tr>
<tr>
<td><span class="Estilo5">MARCA:</span></td>
<td><span class="Estilo10"><?php echo "$marca";?></span></td>
</tr>
<tr>
<td><span class="Estilo5">MODELO:</span></td>
<td><span class="Estilo10"><?php echo "$modelo";?></span></td>
</tr>
<tr>
<td><span class="Estilo5">Nº SERIE: </span></td>
<td><span class="Estilo10"><?php echo "$n_serie";?></span></td>
</tr>
<tr>
<td><span class="Estilo5">PRECIO:</span></td>
<td><span class="Estilo10"><?php echo "$precio";?></span></td>
</tr>
<tr>
<td><span class="Estilo5">DESCIPCION:</span></td>
<td rowspan="2"><span class="Estilo10"><?php echo "$descripcion";?></span></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<br>
<?
}
}
?>
</body>
</html>
Y las imagenes que llamo desde la web en donde muestro todo las recupero con download.php
Código PHP:
<?
if(isset($_GET['id']))
{
$connection=mysql_connect("www.*****.com","******","******")
or die("Error conectando a la base de datos");
$db=mysql_select_db("dbequipelsol",$connection)
or die ("Error seleccionando la base de datos");
$id = $_GET['id'];
$query = "SELECT name, type, size, foto, thumb FROM equipos WHERE id = '$id'";
$result = mysql_query($query) or die('Error, query failed');
list($name, $type, $size, $foto, $thumb) = mysql_fetch_array($result);
header("Content-Disposition: attachment; filename=$name");
header("Content-length: $size");
header("Content-type: $type");
echo $thumb;
exit;
}
?>