Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/01/2011, 17:34
Avatar de bocho0610
bocho0610
 
Fecha de Ingreso: enero-2010
Ubicación: <? echo "Santiago, Chile"; ?>
Mensajes: 341
Antigüedad: 14 años, 4 meses
Puntos: 26
Respuesta: Consultas desde un campo

y cuanto pagas por todo?? Este es un ejemplo que le hice a una usuaria que pedia lo mismo, espero lo entiendas y lo adaptes-


pagina1.php
Código PHP:
Ver original
  1. <?$ssql=mysql_query("select * from productos");?>
  2. <table>
  3. <td>IMAGEN</td>
  4. <td>TITULO</td>
  5. <td>PRECIO</td>
  6. <td>VER</td>
  7. <tr>
  8. <?while($row=mysql_fetch_assoc($ssql)){?>
  9. <td><?echo $row['imagen']?></td>
  10. <td><?echo $row['titulo']?></td>
  11. <td><?echo $row['precio']?></td>
  12. <td><a href='detalles.php?id='<?echo $row['id']?>'>Ver</a></td>
  13. //mandamos mediante la url el id del producto en cuestion
  14. </tr>
  15. <?}?>
  16. </table>

detalles.php
Código PHP:
Ver original
  1. //en esta pagina mediante el metodo GET obtenemos el id que nos mando
  2. //la pagina anterior.
  3. <?$id=$_GET['id'];
  4. $ssql=mysql_query("select * from productos where id='".$id."'");
  5. $row=mysql_fetch_assoc($ssql);?>
  6.  
  7. <table>
  8. <td>IMAGEN</td><td><?echo $row['imagen']?></td>
  9. <td>TITULO</td><td><?echo $row['titulo']?></td>
  10. <td>DESCRIPCION</td><td><?echo $row['descripcion']?></td>
  11. <td>PRECIO</td><td><?echo $row['precio']?></td>
  12. <td>UNIDADES</td><td><?echo $row['unidades']?></td>
  13. <td>ETC</td><td><?echo $row['etc']?></td>
  14. </table>
__________________
Sigueme en Twitter!
Septimoarte.cl <-- Un mundo en cine.