Ver Mensaje Individual
  #3 (permalink)  
Antiguo 30/01/2015, 09:21
spark21
 
Fecha de Ingreso: diciembre-2007
Mensajes: 38
Antigüedad: 16 años, 4 meses
Puntos: 1
Respuesta: else if echo imagen en tabla

Hola, gracias por contestar,

No nos da ningún error, simplemente hemos aplicado el código que supuestamente llama echo a una imagen cuando "elseif" de la columna "accepted" es 1 u otra imagen si es 2. cada dibujo va en una celda de la tabla.
Es como un check point, tiene la ruta "A" hecha, sí (1) entonces muestra el dibujo vistobueno.jpg, no (2) entonces muestra el dibujo vistomalo.jpg.
Cada ruta está nombrada como tabladetours, tabladetours2, etc.

Pero tal y como se ve en el enlace no termina de mostrar el dibujo en la ruta ANT-2:
http://www.argavirtual.com/lib/skins/TABLA%20DE%20JOSE.php

ANT-3 no se ve porque el valor es 0 y quiero que no muestre nada, si fuese 2 querría el vistomalo.png

Vuelvo a poner el código pero con la etiqueta php

Código PHP:
mysql_select_db($database_byethost$byethost);
$query_tabladetours "SELECT `phpvms_pireps`.`pilotid`, `phpvms_pireps`.`accepted` FROM phpvms_pireps WHERE ((`phpvms_pireps`.`pilotid` = '0377') AND (`phpvms_pireps`.`flightnum` = 'ANT-1') AND (`phpvms_pireps`.`accepted` ='1')) ORDER BY `phpvms_pireps`.`pilotid` ASC , `phpvms_pireps`.`flightnum` ASC , `phpvms_pireps`.`accepted` ASC LIMIT 0 , 30";
$tabladetours mysql_query($query_tabladetours$byethost) or die(mysql_error());
$row_tabladetours mysql_fetch_assoc($tabladetours);
$totalRows_tabladetours mysql_num_rows($tabladetours);


mysql_select_db($database_byethost$byethost);
$query_tabladetours1 ="SELECT `phpvms_pireps`.`pilotid`, `phpvms_pireps`.`accepted` FROM phpvms_pireps WHERE ((`phpvms_pireps`.`pilotid` = '0377') AND (`phpvms_pireps`.`flightnum` = 'ANT-2') AND (`phpvms_pireps`.`accepted` ='1')) ORDER BY `phpvms_pireps`.`pilotid` ASC , `phpvms_pireps`.`flightnum` ASC , `phpvms_pireps`.`accepted` ASC LIMIT 0 , 30";
$tabladetours1mysql_query($query_tabladetours1$byethost) or die(mysql_error());
$row_tabladetours1mysql_fetch_assoc($tabladetours1);
$totalRows_tabladetours1mysql_num_rows($tabladetours1);

mysql_select_db($database_byethost$byethost);
$query_tabladetours2 ="SELECT `phpvms_pireps`.`pilotid`, `phpvms_pireps`.`accepted` FROM phpvms_pireps WHERE ((`phpvms_pireps`.`pilotid` = '0377') AND (`phpvms_pireps`.`flightnum` = 'ANT-3') AND (`phpvms_pireps`.`accepted` ='1')) ORDER BY `phpvms_pireps`.`pilotid` ASC , `phpvms_pireps`.`flightnum` ASC , `phpvms_pireps`.`accepted` ASC LIMIT 0 , 30";
$tabladetours2mysql_query($query_tabladetours2$byethost) or die(mysql_error());
$row_tabladetours2mysql_fetch_assoc($tabladetours2);
$totalRows_tabladetours2mysql_num_rows($tabladetours2);

mysql_select_db($database_byethost$byethost);
$query_tabladetours3 ="SELECT `phpvms_pireps`.`pilotid`, `phpvms_pireps`.`accepted` FROM phpvms_pireps WHERE ((`phpvms_pireps`.`pilotid` = '0377') AND (`phpvms_pireps`.`flightnum` = 'ANT-4') AND (`phpvms_pireps`.`accepted` ='1')) ORDER BY `phpvms_pireps`.`pilotid` ASC , `phpvms_pireps`.`flightnum` ASC , `phpvms_pireps`.`accepted` ASC LIMIT 0 , 30";
$tabladetours3mysql_query($query_tabladetours3$byethost) or die(mysql_error());
$row_tabladetours3mysql_fetch_assoc($tabladetours3);
$totalRows_tabladetours3mysql_num_rows($tabladetours3); 
Código PHP:
<table border="5" align="left">
  <tr>
    <td bgcolor="#CC3300"><div align="center"><strong>ID de piloto ARV:</strong></div></td>
    <td bgcolor="#CC3300"><div align="center"><strong>ANT-1</strong></div></td>
    <td bgcolor="#CC3300"><div align="center"><strong>ANT-2</strong></div></td>
    <td bgcolor="#CC3300"><div align="center"><strong>ANT-3</strong></div></td>
    <td bgcolor="#CC3300"><div align="center"><strong>ANT-4</strong></div></td>  
    </div></td>
  </tr>
  <?php do { ?>
    <tr>
      <td bgcolor="#FFFFFF"><strong>ARV</strong><?php echo $row_tabladetours['pilotid']; ?></td>
      <td bgcolor="#FFFFFF"><?php echo $row_tabladetours['accepted']; ?><img src='http://argavirtual.com/lib/skins/templatemo_254_agency/images/vistobueno.gif'></td>
      <td bgcolor="#FFFFFF"><?php echo $row_tabladetours1['accepted']; ?><?php if ($row_tabladetours1->accepted == 1) {echo "<img src='http://argavirtual.com/lib/skins/templatemo_254_agency/images/vistobueno.gif'></img>";}
  elseif (
$row_tabladetours1->accepted == 2) {echo "<img src='http://argavirtual.com/lib/skins/templatemo_254_agency/images/vistomalo.png'></img>";}
?></td>
      <td bgcolor="#FFFFFF"><?php echo $row_tabladetours2['accepted']; ?><?php if ($row_tabladetours2->accepted == 1) {echo '<img src="http://argavirtual.com/lib/skins/templatemo_254_agency/images/vistobueno.gif"></img>';}
  elseif (
$row_tabladetours2->accepted == 2){ echo '<img src="http://argavirtual.com/lib/skins/templatemo_254_agency/images/vistomalo.png"></img>';}
?></td>
      <td bgcolor="#FFFFFF"><?php echo $row_tabladetours3['accepted']; ?><img src='http://argavirtual.com/lib/skins/templatemo_254_agency/images/vistobueno.gif'></td> 
    </tr>
    <?php } while ($row_tabladetours mysql_fetch_assoc($tabladetours));
            while (
$row_tabladetours1 mysql_fetch_assoc($tabladetours1));?>
</table>


<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result
($tabladetours);
mysql_free_result($tabladetours1);
?>