![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
22/01/2011, 20:46
|
| | Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 14 años, 4 meses Puntos: 6 | |
php . cliclos hola amigos
tengo el siguiente problema
tengo dos tablas
CREATE TABLE articulos
(
id_articulo serial NOT NULL,
categoria integer,
proveedor character varying(64),
referencia character varying(64),
nombre character varying(64),
stock integer,
estado integer,
descripcion text,
precio integer,
venta integer,
descuento integer,
q_inventario integer DEFAULT 0,
q_vendida integer DEFAULT 0,
CONSTRAINT pk_articulos PRIMARY KEY (id_articulo)
)
CREATE TABLE categoria
(
id serial NOT NULL,
nombre character varying(64),
observaciones text,
CONSTRAINT pk_categoria PRIMARY KEY (id)
)
realizo la consulta
SELECT * FROM categoria INNER JOIN articulos ON categoria.id = articulos.categoria where estado = 1 ORDER BY categoria, id
la cual me arroja como resultado
Nombre id_articulo
"lociones" 14
"Televisores" 15
"lavadoras" 9
"DVD" 8
"DVD" 10
necesito imprimir este resultado en una tabla pero ke sea asi
lociones
14
Televisores
15
lavadoras
9
DVD
8
10
hasta el momento tengo
$categoria=0;
foreach($fp as $field)
{
if($categoria = $field['categoria']) {
echo $field['nombre'] . ' ' . $field['categoria']."<br>";
// Ahora habra que comparar con esta empresa
$categoria = $field['categoria'];
} |