Ver Mensaje Individual
  #3 (permalink)  
Antiguo 01/04/2009, 13:20
esaenz22
(Desactivado)
 
Fecha de Ingreso: abril-2008
Mensajes: 787
Antigüedad: 16 años, 1 mes
Puntos: 7
Respuesta: como mostrar datos de una tabla en codigo html?

hola. lo k tiene sk hacer es mezclar el codigo html con el php.

Código PHP:

<?php
    
include("config.php");
?>
<!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>Untitled Document</title>
</head>

<body>
<ul id="catalog">
                
<?php

$registros
=mysql_query("select nombre,precio,descripcion
                       from equipos"
,$conexion) or
                         die(
"Problemas en el select:".mysql_error());
    while (
$reg=mysql_fetch_array($registros)){
?>
<li>    
    <img src="images/products/redShoe.jpg" alt="Red Shoe" />
    <span class="price"><?php echo $reg['precio']; ?></span><b><?php echo $reg['nombre']; ?><br/>
    <a href="#" onclick="simpleCart.add('name=<?=$reg['nombre']; ?>','price=<?=$reg['precio']; ?>','image=images/thumbs/redShoe.jpg');return false;"> add to cart</a></b>
</li>
<?php
    
}
?>
</ul>
</body>
</html>