aYuda al moStrar datis de data base
Hola
Tengo el siguiente problema al entrar en esta pagina:
212.79.158.229/webware/agencia.php y pinchar en un campo no me muestra exclusivamente el campo que has pinchado sino que me lista todo lo que esta en la base de datos, el codigo es el siguiente
Agencia.php:
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<?
$bd="********";
$tabla="****";
$c=mysql_connect("*l****","*****");
mysql_select_db($bd,$c);
$resultado=mysql_query("SELECT * FROM $tabla",$c);
?>
<p align="center"><font color="#FF0000" size="6"><strong><em>Códigos (la prueba)</em></strong></font></p>
<div align="center">
<table width="67%" height="55" border="1">
<tr>
<td width="19%"><div align="center"><font color="#0000FF" size="4"><strong><em>Nombre</em></strong></font></div></td>
</tr>
<?
while ($registro=mysql_fetch_row($resultado))
{
?>
<tr>
<td height="22"><div align="center"><a href="agencia1.php?id=<? echo $registro[0]; ?>"><strong><font color="#000000" size="3"><em><? echo $registro[1]; ?></em></font></strong></a></div></td>
</tr>
<?
}
?>
</table>
</div>
<p> </p>
<p> </p>
<? mysql_close();?>
</body>
Agencia1.php:
<?
$bd="********";
$tabla="*********";
$c=mysql_connect("*********","*****");
mysql_select_db($bd,$c);
$id= id ;
$resultado=mysql_query("SELECT * FROM $tabla WHERE $id ",$c);
?>
<p align="center"><font color="#FF0000" size="6"><strong><em>Codigos muestra </em></strong></font></p>
<div align="center">
<table width="67%" height="99" border="1">
<tr>
<td width="19%"><div align="center"><font color="#0000FF" size="4"><strong><em>Nombre</em></strong></font></div></td>
<td width="24%"><div align="center"><font color="#0000FF" size="4"><strong><em>Codigo</em></strong></font></div></td>
</tr>
<?
while ($registro=mysql_fetch_row($resultado))
{
?>
<tr>
<td height="68"><div align="center"><strong><font color="#000000" size="3"><em><?echo $registro[1];?></em></font></strong></a></div></td>
<td><div align="center"><strong><font size="4"><em><?echo $registro[2];?></em></font></strong></a><font size="4"><em></em></font></div></td>
</tr>
<?
}
?>
</table>
</div>
<p> </p>
<p> </p>
<? mysql_close();?>
</body>
</body>
QUE ES LO QUE ME FALLA??? PARA QUE ME MUESTRE EL RESULTADO SOLO DEL CAMPO AL QUE PICAS???
Tengo el siguiente problema al entrar en esta pagina:
212.79.158.229/webware/agencia.php y pinchar en un campo no me muestra exclusivamente el campo que has pinchado sino que me lista todo lo que esta en la base de datos, el codigo es el siguiente
Agencia.php:
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<?
$bd="********";
$tabla="****";
$c=mysql_connect("*l****","*****");
mysql_select_db($bd,$c);
$resultado=mysql_query("SELECT * FROM $tabla",$c);
?>
<p align="center"><font color="#FF0000" size="6"><strong><em>Códigos (la prueba)</em></strong></font></p>
<div align="center">
<table width="67%" height="55" border="1">
<tr>
<td width="19%"><div align="center"><font color="#0000FF" size="4"><strong><em>Nombre</em></strong></font></div></td>
</tr>
<?
while ($registro=mysql_fetch_row($resultado))
{
?>
<tr>
<td height="22"><div align="center"><a href="agencia1.php?id=<? echo $registro[0]; ?>"><strong><font color="#000000" size="3"><em><? echo $registro[1]; ?></em></font></strong></a></div></td>
</tr>
<?
}
?>
</table>
</div>
<p> </p>
<p> </p>
<? mysql_close();?>
</body>
Agencia1.php:
<?
$bd="********";
$tabla="*********";
$c=mysql_connect("*********","*****");
mysql_select_db($bd,$c);
$id= id ;
$resultado=mysql_query("SELECT * FROM $tabla WHERE $id ",$c);
?>
<p align="center"><font color="#FF0000" size="6"><strong><em>Codigos muestra </em></strong></font></p>
<div align="center">
<table width="67%" height="99" border="1">
<tr>
<td width="19%"><div align="center"><font color="#0000FF" size="4"><strong><em>Nombre</em></strong></font></div></td>
<td width="24%"><div align="center"><font color="#0000FF" size="4"><strong><em>Codigo</em></strong></font></div></td>
</tr>
<?
while ($registro=mysql_fetch_row($resultado))
{
?>
<tr>
<td height="68"><div align="center"><strong><font color="#000000" size="3"><em><?echo $registro[1];?></em></font></strong></a></div></td>
<td><div align="center"><strong><font size="4"><em><?echo $registro[2];?></em></font></strong></a><font size="4"><em></em></font></div></td>
</tr>
<?
}
?>
</table>
</div>
<p> </p>
<p> </p>
<? mysql_close();?>
</body>
</body>
QUE ES LO QUE ME FALLA??? PARA QUE ME MUESTRE EL RESULTADO SOLO DEL CAMPO AL QUE PICAS???
En el select $resultado....no tienes ninguna comparacion....pone where $id .... sin ningun = a algo...sera eso??? tampoco m miré mucho el codigo...pero eso no m gustó :P
suerte!
suerte!
el lio lo tienes en agencia1.php en la parte donde recibes la variable que pasas por URL. la tienes que recibir como $_GET[\'id\'].
entonces te queda de la siguiente manera.
$id = $_GET[\'id\'];
$resultado=mysql_query("SELECT * FROM $tabla WHERE $id ",$c);
y listo te debe funcionar...
Salñudos
entonces te queda de la siguiente manera.
$id = $_GET[\'id\'];
$resultado=mysql_query("SELECT * FROM $tabla WHERE $id ",$c);
y listo te debe funcionar...
Salñudos