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";
$tabladetours1= mysql_query($query_tabladetours1, $byethost) or die(mysql_error());
$row_tabladetours1= mysql_fetch_assoc($tabladetours1);
$totalRows_tabladetours1= mysql_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";
$tabladetours2= mysql_query($query_tabladetours2, $byethost) or die(mysql_error());
$row_tabladetours2= mysql_fetch_assoc($tabladetours2);
$totalRows_tabladetours2= mysql_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";
$tabladetours3= mysql_query($query_tabladetours3, $byethost) or die(mysql_error());
$row_tabladetours3= mysql_fetch_assoc($tabladetours3);
$totalRows_tabladetours3= mysql_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> </p>
<p> </p>
<p> </p>
</body>
</html>
<?php
mysql_free_result($tabladetours);
mysql_free_result($tabladetours1);
?>