Código PHP:
<?php
$con = mysqli_connect("mysql.hostinger.es", "u770389492_root", "***")or die("Error ");
mysqli_select_db($con, 'u770389492_carri');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="../css/EstiloIMG.css" rel="stylesheet" type="text/css" />
<title>Editor Contenido</title>
</head>
<body>
<div id="principal">
<?php
if($Novedades)
{
$consultar=mysqli_query($con,"SELECT foto, texto, id FROM novedades", MYSQLI_USE_RESULT) or die(mysqli_error($con));
$ruta=$Novedades;
}
if($Llaveros)
{
$consultar=mysqli_query($con,"SELECT foto, texto, id FROM llaveros", MYSQLI_USE_RESULT) or die(mysqli_error($con));
$ruta=$Llaveros;
}
if($Colgantes)
{
$consultar=mysqli_query($con,"SELECT foto, texto, id FROM colgantes", MYSQLI_USE_RESULT) or die(mysqli_error($con));
$ruta=$Colgantes;
}
if($Imanes)
{
$consultar=mysqli_query($con,"SELECT foto, texto, id FROM imanes", MYSQLI_USE_RESULT) or die(mysqli_error($con));
$ruta=$Imanes;
}
if($Figuras)
{
$consultar=mysqli_query($con,"SELECT foto, texto, id FROM figuras", MYSQLI_USE_RESULT) or die(mysqli_error($con));
$ruta=$Figuras;
}
if($Joyeros)
{
$consultar=mysqli_query($con,"SELECT foto, texto, id FROM joyeros", MYSQLI_USE_RESULT) or die(mysqli_error($con));
$ruta=$Joyeros;
}
if($PortaCascos)
{
$consultar=mysqli_query($con,"SELECT foto, texto, id FROM portacascos", MYSQLI_USE_RESULT) or die(mysqli_error($con));
$ruta=$PortaCascos;
}
if($MarcaPaginas)
{
$consultar=mysqli_query($con,"SELECT foto, texto, id FROM marcapaginas", MYSQLI_USE_RESULT) or die(mysqli_error($con));
$ruta=$MarcaPaginas;
}
if($MarcosFotos)
{
$consultar=mysqli_query($con,"SELECT foto, texto, id FROM marcosfotos", MYSQLI_USE_RESULT) or die(mysqli_error($con));
$ruta=$MarcosFotos;
}
if (isset($consultar)) {
while($imagenes=mysqli_fetch_array($consultar))
{
echo "<table class='tablacss' border='2' width='100%'>";
$imagen=$imagenes['foto'];
$texto=$imagenes['texto'];
$idImagen=$imagenes['id'];
$precio=$imagenes['precio'];
echo "<tr>
<td><img src='../$imagen' width='150' height='100'></td>
</tr>
<tr>
<td>$texto</td>
</tr>
<tr>
<td>Precio: $precio €</td>
</tr>
<tr>
<td><a href='eliminarImagen.php?idImagen=$idImagen'>Eliminar</a></td>
</tr>
<tr>
<td><a href='cambiarImagen.php?idImagen=$idImagen&texto=$texto&imagen=$imagen&ruta=$ruta'>Cambiar</a></td>
</tr>";
echo "</table>";
}
mysqli_free_result($consultar);
}
else {
echo "PARA CAMBIAR ALGUNA FOTO, PULSE EN EL BOTÓN";
}
mysqli_close($con);
?>
</div>
<div id="formulario">
<form method='post' action="verImagenes.php">
<input name='Novedades' type='submit' value='novedades' />
<input name='Llaveros' type='submit' value='llaveros' />
<input name='Colgantes' type='submit' value='colgantes' />
<input name='Imanes' type='submit' value='imanes' />
<input name='Figuras' type='submit' value='figuras' />
<input name='Joyeros' type='submit' value='joyeros' />
<input name='PortaCascos' type='submit' value='porta-cascos' />
<input name='MarcaPaginas' type='submit' value='marca-paginas' />
<input name='MarcosFotos' type='submit' value='marcos de fotos' />
</form>
<!--<form method='post' action='insertar.php' enctype='multipart/form-data'>-->
<form method='post' action='recibe.php' enctype='multipart/form-data'>
<br /><br />
<label>Elige Imagen:</label>
<br/>
<p>Ruta de la imagen: <?php echo "$ruta"; ?>/</p>
<input type="hidden" name="ruta" value="<?php echo "$ruta"; ?>"/>
<!--<input type='file' name='imagen'/>-->
<input type="file" name="archivo" />
<input type="hidden" name="MAX_FILE_SIZE" value="500000">
<br/><br />
<!--<label>Precio (€)</label>
<input type="text" name="precio" value="" />
<br />-->
<label>Descripcion:</label>
<br/>
<textarea cols='50' rows='10' name='texto'></textarea>
<br/>
<input type='submit' value='Insertar'/>
</form>
</div>
</body>
</html>
¿alguna idea?