Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/07/2014, 10:08
galaktico
 
Fecha de Ingreso: julio-2008
Mensajes: 57
Antigüedad: 15 años, 9 meses
Puntos: 0
Consulta Página Detalle / Maestro con PHP

Buenos días! Tengo realizada una página resultado y una página detalle con PHP.

El problema es que paso el ID del producto seleccionado pero en la página detalle evidentemente me está faltando algo que no entiendo. Me podrán ayudar por favor?

Código resultado.php:

<?php
include("conexion.php");

$consulta="SELECT * FROM productos";
$resultado=mysql_query($consulta);
$count_results = mysql_num_rows($resultado);
?>
<!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=UTF-8" />
<title></title>
</head>
<body>
<?php if ($count_results > 0) { ?>
<div>Se encontraron los siguientes resultados:</div>
<table width="320" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Nombre</td>
<td>Ver Detalles</td>
</tr>
<?php
while($fila=mysql_fetch_array($resultado)) { ?>
<tr>
<td><?php echo $fila["nombre"]; ?></td>
<td><a href="detalle.php?id=<?php echo $fila["id_producto"]; ?> target="_self">SI</a></td>
</tr>
<?php } ?>
</table>
<?php } ?>
<?php if ($count_results == 0) { ?>
<div>No se encontraron resultados.</div>
<?php } ?>
</body>
</html>

Código detalle.php:

<?php
include("conexion.php");

$consulta="SELECT * FROM productos";
$resultado=mysql_query($consulta);

?>
<!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=UTF-8" />
<title></title>
</head>
<body>
<table width="320" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Nombre</td>
<td>Categoria</td>
</tr>
<tr>
<td><?php echo $fila["nombre"]; ?></td>
<td><?php echo $fila["categoria"]; ?></td>
</tr>
</table>
</body>
</html>

Muchas gracias!