Ver Mensaje Individual
  #70 (permalink)  
Antiguo 17/11/2011, 05:27
edyuin
(Desactivado)
 
Fecha de Ingreso: septiembre-2011
Mensajes: 283
Antigüedad: 13 años, 4 meses
Puntos: 10
Respuesta: como hacer un if

Este es el codigo que uso y nose como hacer eso que quiero hacerle:
Código PHP:
<?php
echo "".$reg['nombre']."<br>" ;
 
?>
<?php
$consulta
="select Estado from amigos where id_logueado='$id_usuario' and id_amigo='$reg[id]'";
$ejecuta=mysql_query($consulta) or  die("Problemas en el select:".mysql_error());
$cantidad=mysql_num_rows($ejecuta);
$consulta1="select Estado from amigos where id_logueado='$reg[id]' and id_amigo='$id_usuario'";
$ejecuta1=mysql_query($consulta1) or die ("Problemas en el select:".mysql_error());
$cantidad1=mysql_num_rows($ejecuta1);
if(
$cantidad 0)
{
$row mysql_fetch_assoc($ejecuta);
    switch(
$row['Estado'])
    {    
         case 
'pendiente':
                 echo 
'<div class="amigos">Ya mandaste petición</div>';
                break;
         case 
'aceptado':
                 echo 
"Es amigo";
                break;
        
    }
}
elseif(
$cantidad1 0)
{
$row1mysql_fetch_assoc($ejecuta1);
    switch(
$row1['Estado'])
    {
        case 
'pendiente':
                echo 
'<div class="amigos">
                <form action="agregara.php" method="post">
                <input type="hidden" name="id" value="'
.$reg['id'].'">
                <input type="hidden" name="accion" value="modificar">
                <input type="submit" value="Aceptar petición">
                </form>
                </div>'
;
                break;
        case 
'aceptado':
                echo 
"Es amigo";
                break;
    }
}
else 
    {
       echo 
'<div class="amigos">
 <form action="agregara.php" method="post">
 <input type="hidden" name="id" value="'
.$reg['id'].'">
 <input type="hidden" name="accion" value="insertar">
 <input type="submit" value="Agregar Amigos">
 </form>
 </div>'
;
 } 
      


?>
es que quiero que salga en el mismo sitio donde sale normalmente el nombre gracias.