gracias me a servido mucho pero tengo otro problema ahora, estoy intentando hacer un sistema de amigos para agregarse entre los usuarios, y resulta que e mandado una peticion y el boton desaparecio para todos los demas la tabla es esta:
CREATE TABLE `amigos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_logueado` text COLLATE latin1_general_ci NOT NULL,
`id_amigo` text COLLATE latin1_general_ci NOT NULL,
`Estado` text COLLATE latin1_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ;
y el archivo que los muestra y hace que salga el boton o no es eeste
Código PHP:
<?php
include("header.php");
if (!isset($_SESSION['logueado_usuario'])) {
include ("../login.php");
echo "<a href='../registro.php'>Registrarse</a>" ;}
else {
$nombre =$_SESSION['logueado_nombre'];
$id_usuario=$_SESSION['logueado_id'];
?>
<link href="../Css/estilo.css" rel="stylesheet" type="text/css">
<?php
include("privados/config.php");
$registros=mysql_query("select * from usuarios ORDER BY id desc ", $conexion)or
die("Problemas en el select:".mysql_error());
while($reg=mysql_fetch_array($registros))
{ ?>
<img src="<?php echo "".$reg['imagen']. "";?>" />
<?php
echo "".$reg['nombre']."<br>" ;
?>
<?php
$consulta=mysql_query("select Estado from amigos where id_amigo='$reg[id]'", $conexion)or
die("Problemas en el select:".mysql_error());
while($cons=mysql_fetch_assoc($consulta))
{
if($cons['Estado']==pendiente)
{
echo "espere a que te acepten";
}
else
{ ?>
<div class="amigos"><form action="agregara.php" method="post">
<input type="hidden" name="id" value="<?php echo "".$reg['id']."" ?>">
<input type="submit" value="Agregar Amigos">
</form></div>
<?php }
}
?>
<div id="consulta"></div>
<? } ?>
<?php } ?>
que debo cambiar para que solo no salga el boton al que le mande la peticion?? gracias.