Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/10/2005, 23:54
sevastian
 
Fecha de Ingreso: octubre-2005
Mensajes: 27
Antigüedad: 18 años, 6 meses
Puntos: 0
problema con el combo

HOLAS FORO COMO ESTAN BUYA OTRA VES CON CONSULTA LO QUE PASA Q ESTOY HACIEN UN LISTAR Y TENGO UN DOS TABLAS UNA D¡Q ES DE UN GRUPO DE USUARIO Y LA OTRA ES DE LOS USUARIOS DONDE SALEN EL TIPO O AL GRUPO AL Q PERTENESE Y MI PROBLEMA ES Q LO MUESTRA PERO MUESTRA SOLO EL NUMERO Y YO QUIERO Q MUESTRE EL NOMBRE DEL GRUPO Y NO SE COMO HACERLO PORFA UNA MANO PLEASE... MIREN LES EMBIO EL CODIGO O PEDASITO PARA Q ME DIGAN DONDE AHY Q PONER LO Q ME FALTA PORFA

<?php
echo"<html>\n";
echo"<head>\n";
echo"<title>listar</title>\n";
echo"</head>\n";
session_start();
session_register('LOGIN');
$LOGIN;

$enlace = mysql_connect("localhost", "root", "")or die("No pudo conectarse : " . mysql_error());
//echo "Conexi&oacute;n exitosa";
mysql_select_db("hospital") or die("No pudo seleccionarse la BD.");

$consulta = "SELECT usuario.ID_USUARIO,usuario.ID_GRUPO,usuario.NOMBRE ,usuario.APELLIDO,usuario.LOGIN,usuario.PAS
from usuario
inner join GRUPO on usuario.ID_GRUPO=GRUPO.ID_GRUPO";
// COMO LO AGO PARA QUE ME TIRE LOS ID_USARIO DEL MAS GRANDE AL MAS CHICO.

echo"res=$res";
$res = mysql_query($consulta) or die("La consulta fall&oacute;: " . mysql_error());
$num=mysql_numrows($res);
mysql_close();
echo"<body>\n";
$semasforo=FALSE;
echo"<center><h2>LISTADO DE USUARIOS<b></b></h2></center>\n";
echo"<center>\n";
echo"<table border='0' width='750'>\n";
echo"<tr bgcolor='#0099FF'>\n";
echo"<td width='80' align='center'><b>ID_USUARIO</b></td>\n";
echo"<td width='160' align='center'><b>GRUPO</b></td>\n";
echo"<td width='160' align='center'><b>NOMBRE</b></td>\n";
echo"<td width='180' align='center'><b>APELLIDO</b></td>\n";
echo"<td width='80' align='center'><b>LOGIN</b></td>\n";
echo"<td width='80' align='center'><b>PAS</b></td>\n";


echo"<tr>\n";

$i=0;
while ($i < $num) {
if ($semasforo)
{
$color="#99CCFF";
}
else
{
$color="#66FFFF";
}

$id_usuario=mysql_result($res,$i,"ID_USUARIO");
$id_grupo=mysql_result($res,$i,"ID_GRUPO");
$nombre=mysql_result($res,$i,"NOMBRE");
$apellido=mysql_result($res,$i,"APELLIDO");
$login=mysql_result($res,$i,"LOGIN");
$pas=mysql_result($res,$i,"PAS");




echo"<tr bgcolor=$color>\n";
echo"<td>$id_usuario</td>";// AQUI COMO AGO PARA Q APARESCA EL NOMBRE DEL GRUPO DE USUARIO NO EL NUMERO DEL GRUPO TENGO DOS TABLAS USUARIO.ID_GRUPO Y GRUPO.ID Y GRUPO.NOMBRE
echo"<td>$id_grupo</td>" ;
echo"<td>$nombre</td>" ;
echo"<td>$apellido</td>";
echo"<td><center>$login</center></td>";
echo"<td>$pas</td>";

echo"<tr>\n";
$i++;
$semasforo=!$semasforo;
}
echo"</table>\n";
echo"</center>\n";
echo"<form action='agregarusuario.php' method='post' name=''>\n";
echo"<center>\n";
echo"<table border='0'>\n";
echo"<tr>\n";
echo"<td width='100%' height='19' colspan='2'> <p align='center'>\n";
echo"<input type='submit' value='Insertar' name='btninsertar'>\n";
echo"</td>\n";
echo"</tr>\n";
echo"</table>\n";
echo"</center>\n";
echo"</form>\n";

/* Liberar conjunto de resultados */
//mysql_free_result($res);

echo"</body>\n";
echo"</html>\n";
?>

gracias de ante mano