Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/06/2014, 13:42
jorgemedina2406
 
Fecha de Ingreso: abril-2014
Mensajes: 14
Antigüedad: 10 años
Puntos: 0
Respuesta: Condicional IF

Buenas tardesm realice este codigo:

Código PHP:
Ver original
  1. <?php
  2.                   include("ControlaBD.php");
  3.  
  4.     $con   = new ControlaBD();
  5.     $idcon = $con->conectarSBD();
  6.     $sel_bd= $con->select_BD("admincasos");
  7. if ($id==1){
  8. $result = mysql_query("SELECT id_estatus, Nro_Ticket, Usuario, Fecha_Inicial FROM caso where id_estatus=1 and id_plataforma=1");
  9.         if ($row = mysql_fetch_array($result)){
  10.    echo "<table border = '1'> \n";
  11.    echo "<tr><td>Estatus</td><td># Ticket</td><td>Usuario</td><td>Fecha Inicial</td></tr> \n";
  12.    do {
  13.       echo "<tr><td>".$row["id_estatus"]."</td><td>".$row["Nro_Ticket"]."</td><td>".$row["Usuario"]."</td><td>".$row["Fecha_Inicial"]."</td></tr> \n";
  14.    } while ($row = mysql_fetch_array($result));
  15.    echo "</table> \n";
  16. } else {
  17. echo "¡ No se ha encontrado ningún registro !";
  18. }
  19.     } elseif ($id==2){
  20. $result = mysql_query("SELECT id_estatus, Nro_Ticket, Usuario, Fecha_Inicial FROM caso where id_estatus=1 and id_plataforma=2");
  21. if ($row = mysql_fetch_array($result)){
  22.    echo "<table border = '1'> \n";
  23.    echo "<tr><td>Estatus</td><td># Ticket</td><td>Usuario</td><td>Fecha Inicial</td></tr> \n";
  24.    do {
  25.       echo "<tr><td>".$row["id_estatus"]."</td><td>".$row["Nro_Ticket"]."</td><td>".$row["Usuario"]."</td><td>".$row["Fecha_Inicial"]."</td></tr> \n";
  26.    } while ($row = mysql_fetch_array($result));
  27.    echo "</table> \n";
  28. } else {
  29. echo "¡ No se ha encontrado ningún registro !";
  30. }
  31.     }
  32. else { echo "nada";
  33.     }
  34.  
  35.    
  36. ?>

No me esta corriendo el IF superior, me muestra como resultado el ultimo Else que es el que dice "NADA"

la variable $id la estoy recogiendo por la pagina anterior, coloque esto:

Código HTML:
Ver original
  1. <td><a href="consulta.php?id=1"><img src="img/caballos.png" width="150" height="150"></td>
  2.     <td><a href="consulta.php?id=2"><img src="img/imagen.png" width="150" height="150"></td>

Si ven algun error y me pueden ayudar se los agradeceria