Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/06/2008, 16:23
raab
 
Fecha de Ingreso: mayo-2008
Ubicación: Guadalajara
Mensajes: 28
Antigüedad: 15 años, 11 meses
Puntos: 0
Exclamación no puedo mostar un registro

podrian ayudarme a ver si tengo algo mal por aqui que no funciona jaja el select max() de preferencia gcs

<table border="1" cellpadding="0" cellspacing="0">

<tr>
<th colspan="5" width="300">Compra</th>
</tr>
<tr>
<th width="150">Cod Compra</th>
<th width="150">Cod de Articulo</th>
<th width="150">Cod Proveedor</th>
<th width="150">Forma de Pago</th>
<th width="150">Num de Articulos</th>
<th width="150">Total</th>

</tr>

<?php
$query="SELECT MAX(cod_compra) maximo FROM compras";
$resultado=mysql_query($query,$conexion);
while ( $fila=mysql_fetch_array($resultado) )
{
$max=$fila["maximo"];
}
$query="SELECT cod_compra, cod_articulo, cod_prov, forma_pago_c, num_art_comp, total_compra FROM compras WHERE cod_compra='$max'";
$com=mysql_query($query,$conexion);

while($art=mysql_fetch_array($com)){
?>
<tr>
<th width="150"><?php echo $art["cod_compra"]?></th>
<th width="150"><?php echo $art["cod_articulo"]?></th>
<th width="150"><?php echo $art["cod_prov"]?></th>
<th width="150"><?php echo $art["forma_pago_c"]?></th>
<th width="150"><?php echo $art["num_art_comp"]?></th>
<th width="150"><?php echo $art["total_compra"]?></th>
</tr>
<?php
}
?>

<BR><BR>

</table>