procesanoticia.php
Código PHP:
<?php
//recibo las variables enviadas por el formulario
$titulo=$_POST[titulo];
$categoria=$_POST[categoria];
$precioantes=$_POST[precioantes];
$precioahora=$_POST[precioahora];
$fotouno=$_POST[fotouno];
$fotodos=$_POST[fotodos];
$fototres=$_POST[fototres];
$fotounogrande=$_POST[fotounogrande];
$fotodosgrande=$_POST[fotodosgrande];
$fototresgrande=$_POST[fototresgrande];
$descripcionuno=$_POST[descripcionuno];
$descripciondos=$_POST[descripciondos];
$descripciontres=$_POST[descripciontres];
$fecha=$_POST[fecha];
$descripcion=$_POST[descripcion];
//conecto a la base
$connect=mysql_connect("localhost","an000304_matias","***");
//Seleccionamos la base
mysql_select_db("an000304_sistemanoticias",$connect);
//inserto los registros
$query = "INSERT INTO productos (categoria,titulo,precioantes,precioahora,fotouno,fotodos,fototres,fotounogrande,fotodosgrande,fototresgrande,descripcionuno,descripciondos,descripciontres,fecha,descripcion) VALUES('$categoria','$titulo','$precioantes','$precioahora','$fotouno','$fotodos','$fototres','$fotounogrande','$fotodosgrande','$fototresgrande','$descripcionuno','$descripciondos','$descripciontres','$fecha','$descripcion',NOW())";
mysql_query($query) or die(mysql_error());
header("location: producto.php");
?>
Código PHP:
<?php
$result=mysql_query("select * from productos where id_producto='$id'",$connect);
while($row=mysql_fetch_array($result))
{
$result2=mysql_query("select * from comentarios where id='$id'",$connect);
$totalcomentarios=mysql_num_rows($result2);
echo '
<span class="Estilo4"><a href="blog.html">'.$row[titulo].' </a></span> </p>
<div class="grid_69 sepline">
<span class="Estilo5">ANTES</span> <span class="Estilo14"><s> $'.$row[precioantes].' </s></span> <span class="Estilo5">AHORA</span> <span class="Estilo14">$'.$row[precioahora].'!</span>
</div>
<div class="grid_81 sepline"> <p>'.$row[descripcion].'</p></div>
<p>
<hr class="linea53">
<hr class="linea54">
</p>
<div id="page-margins">
<div class="example">
<div class="ppy" id="ppy1">
<ul class="ppy-imglist">
<li>
<a href="images/'.$row[fotounogrande].'">
<img src="images/'.$row[fotouno].'" alt="" />
</a>
<span class="ppy-extcaption">
<strong>'.$row[descripcionuno].'</strong>
</span>
</li>
<li>
<a href="images/'.$row[fotodosgrande].'">
<img src="images/'.$row[fotodos].'" alt="" />
</a>
<span class="ppy-extcaption">
<strong>'.$row[descripciondos].'</strong>
</span>
</li>
<li>
<a href="images/'.$row[fototresgrande].'">
<img src="images/'.$row[fototres].'" alt="" />
</a>
<span class="ppy-extcaption">
<strong>'.$row[descripciontres].'</strong>
</span>
</li>
</ul>
<div class="ppy-outer">
<div class="ppy-stage">
<div class="ppy-nav">
<a class="ppy-prev" title="Previous image">Anterior</a>
<a class="ppy-switch-enlarge" title="Enlarge">Agrandar foto</a>
<a class="ppy-switch-compact" title="Close">Cerrar</a>
<a class="ppy-next" title="Next image">Siguiente</a>
</div>
</div>
</div>
<div class="ppy-caption">
<div class="ppy-counter">
Image <strong class="ppy-current"></strong> of <strong class="ppy-total"></strong>
</div>
<span class="ppy-text"></span>
</div>
</div>
<p> </p>';
}
?>
Código PHP:
create table productos (
id_producto int(4) auto_increment not null,
categoria varchar(255),
titulo varchar(255),
precioantes varchar(255),
precioahora varchar(255),
fotouno varchar(255),
fotodos varchar(255),
fototres varchar(255),
fotounogrande varchar(255),
fotodosgrande varchar(255),
fototresgrande varchar(255),
descripcionuno varchar(255),
descripciondos varchar(255),
descripciontres varchar(255),
fecha datetime not null,
descripcion blob, key(id_producto)
)