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

Lo de las 4 veces es porque le preguntamos si el piloto 0377 ha hecho el vuelo ANT-1, y nos muestre su resultado (1, 2, 0 //aceptado, rechazado, pendiente de aceptar), después preguntamos si ha hecho el vuelo ANT-2 etc. hasta llegar a ANT-4.

Sale el código con las imágenes

Código PHP:
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

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);

?>
if($row_tabladetours['accepted']=='1'){
echo ("<img src='http://argavirtual.com/lib/skins/templatemo_254_agency/images/vistobueno.gif'>");
}
elseif($row_tabladetours['accepted']=='2'){
echo ("<img src='http://argavirtual.com/lib/skins/templatemo_254_agency/images/vistomalo.png'>");
}
else{
echo("No mostar nada");


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