Ver Mensaje Individual
  #12 (permalink)  
Antiguo 02/03/2014, 13:27
spark21
 
Fecha de Ingreso: diciembre-2007
Mensajes: 38
Antigüedad: 16 años, 4 meses
Puntos: 1
Respuesta: programacion de tabla con php

Pues uno de los problemas es que no sé como explicarlo, voy a intentarlo.

Como somos nulos para hacer la tabla de la página que te mostré en el mensaje anterior
Código HTML:
Ver original
  1. http://www.greeceairwaysva.com/fss/index.php/tour/details/17
, intentamos hacer una nosotros, una página php que hace una simple consulta:

Código PHP:
Ver original
  1. mysql_select_db($database_byethost, $byethost);
  2. $query_Tablafinaltours = "SELECT `phpvms_pireps`.`pilotid` , `phpvms_pireps`.`accepted` FROM phpvms_pireps WHERE ( ( `phpvms_pireps`.`flightnum` ='GB10' ) AND ( `phpvms_pireps`.`accepted` =1 ) ) ORDER BY `phpvms_pireps`.`pilotid` ASC LIMIT 0 , 300";



Nos devuelve un listado de pilotos que han realizado ese flightnum (GB-01, 1001,1007,1004,etc), este o no aceptado eso lo indica un numero (supongo que habría que hacer un if... echo... para que solo saliera tick al estar aceptado), eso en el eje "Y". En el segundo eje "Y" nos devuelve el flightnum con el criterio anterior.



Lo que queremos conseguir es algo así:



Que el piloto salga en el eje "Y" y el flightnum en el eje "X". De ahí viene todo el tema. Quizás sea mejor hace una tabla nueva que se rellene mediante formulario y reciba los datos del mismo sitio, o no sé bien.

P.D: Este es el código que usamos:

Código PHP:
Ver original
  1. <?php require_once ("/home/argavirt/public_html/Connections/byethost.php"); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. mysql_select_db($database_byethost, $byethost);
  35. $query_tabladetours = "SELECT `phpvms_pireps`.`pilotid` , `phpvms_pireps`.`flightnum` , `phpvms_pireps`.`flightnum` , `phpvms_pireps`.`flightnum` , `phpvms_pireps`.`accepted` FROM phpvms_pireps WHERE ( ( `phpvms_pireps`.`flightnum` ='INDI-1' ) OR ( `phpvms_pireps`.`flightnum` ='INDI-2' ) OR ( `phpvms_pireps`.`flightnum` ='INDI-3' ) OR ( `phpvms_pireps`.`flightnum` ='INDI-4' ) OR ( `phpvms_pireps`.`flightnum` ='INDI-5' ) OR ( `phpvms_pireps`.`flightnum` ='INDI-6' ) AND ( `phpvms_pireps`.`accepted` =1 ) ) ORDER BY `phpvms_pireps`.`pilotid` ASC, `phpvms_pireps`.`flightnum` ASC LIMIT 0 , 300";
  36. $tabladetours = mysql_query($query_tabladetours, $byethost) or die(mysql_error());
  37. $row_tabladetours = mysql_fetch_assoc($tabladetours);
  38. $totalRows_tabladetours = mysql_num_rows($tabladetours);
  39.  
  40. mysql_select_db($database_byethost, $byethost);
  41. $query_tabladetours2 = "SELECT `phpvms_pireps`.`pilotid` , `phpvms_pireps`.`flightnum` , `phpvms_pireps`.`flightnum` , `phpvms_pireps`.`flightnum` , `phpvms_pireps`.`accepted` FROM phpvms_pireps WHERE ( ( `phpvms_pireps`.`flightnum` ='' ) OR ( `phpvms_pireps`.`flightnum` ='' ) OR ( `phpvms_pireps`.`flightnum` ='' ) OR ( `phpvms_pireps`.`flightnum` ='' ) OR ( `phpvms_pireps`.`flightnum` ='' ) OR ( `phpvms_pireps`.`flightnum` ='' ) OR ( `phpvms_pireps`.`flightnum` ='' ) OR ( `phpvms_pireps`.`flightnum` ='' ) OR ( `phpvms_pireps`.`flightnum` ='' ) OR ( `phpvms_pireps`.`flightnum` ='' ) OR ( `phpvms_pireps`.`flightnum` ='' ) OR ( `phpvms_pireps`.`flightnum` ='' ) AND ( `phpvms_pireps`.`accepted` =1 ) ) ORDER BY `phpvms_pireps`.`pilotid` ASC, `phpvms_pireps`.`flightnum` ASC LIMIT 0 , 300";
  42. $tabladetours2 = mysql_query($query_tabladetours2, $byethost) or die(mysql_error());
  43. $row_tabladetours2 = mysql_fetch_assoc($tabladetours2);
  44. $totalRows_tabladetours2 = mysql_num_rows($tabladetours2);
  45.  
  46. mysql_select_db($database_byethost, $byethost);
  47. $query_Tablafinaltours = "SELECT `phpvms_pireps`.`pilotid` , `phpvms_pireps`.`accepted` FROM phpvms_pireps WHERE ( ( `phpvms_pireps`.`flightnum` ='INDI-6' ) AND ( `phpvms_pireps`.`accepted` =1 ) ) ORDER BY `phpvms_pireps`.`pilotid` ASC LIMIT 0 , 300";
  48. $Tablafinaltours = mysql_query($query_Tablafinaltours, $byethost) or die(mysql_error());
  49. $row_Tablafinaltours = mysql_fetch_assoc($Tablafinaltours);
  50. $totalRows_Tablafinaltours = mysql_num_rows($Tablafinaltours);
  51. ?>
  52. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  53. <html xmlns="http://www.w3.org/1999/xhtml">
  54. <head>
  55. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  56. <title>Tabla de tours</title>
  57. <style type="text/css">
  58. body {
  59.     background-color: #333;
  60. }
  61. </style>
  62. <p align="center"><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  63. <!-- phpvms -->
  64. <ins class="adsbygoogle"
  65.      style="display:inline-block;width:728px;height:90px"
  66.      data-ad-client="ca-pub-1435469147537876"
  67.      data-ad-slot="2626704331"></ins>
  68. <script>
  69. (adsbygoogle = window.adsbygoogle || []).push({});
  70. </script></p>
  71. <p align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="468" height="60" id="FlashID" title="Tours_banner">
  72.   <param name="movie" value="http://argavirtual.com/lib/skins/templatemo_254_agency/images/123-banner_com_2319744.swf" />
  73.   <param name="quality" value="high" />
  74.   <param name="wmode" value="opaque" />
  75.   <param name="swfversion" value="6.0.65.0" />
  76.   <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
  77.   <param name="expressinstall" value="/phpvms/Scripts/expressInstall.swf" />
  78.   <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
  79.   <!--[if !IE]>-->
  80.   <object data="http://argavirtual.com/lib/skins/templatemo_254_agency/images/123-banner_com_2319744.swf" type="application/x-shockwave-flash" width="468" height="60">
  81.     <!--<![endif]-->
  82.     <param name="quality" value="high" />
  83.     <param name="wmode" value="opaque" />
  84.     <param name="swfversion" value="6.0.65.0" />
  85.     <param name="expressinstall" value="/phpvms/Scripts/expressInstall.swf" />
  86.     <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
  87.     <div>
  88.       <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
  89.       <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
  90.     </div>
  91.     <!--[if !IE]>-->
  92.   </object>
  93.   <!--<![endif]-->
  94. </object></p>
  95. </head>
  96. <body>
  97. <p>&nbsp;</p>
  98. <table border="5" align="left">
  99.   <tr>
  100.     <td bgcolor="#CC3300"><div align="center"><strong>ID de piloto ARV:</strong></div></td>
  101.     <td bgcolor="#CC3300"><div align="center"><strong>Nº de vuelo</strong></div></td>
  102.     <td bgcolor="#CC3300"><div align="center">
  103.       <p><strong>Completado</strong></p>
  104.       <p><strong>(0=no aceptado; 1=aceptado; 2=Rechazado)</strong></p>
  105.     </div></td>
  106.   </tr>
  107.   <?php do { ?>
  108.     <tr>
  109.       <td bgcolor="#FFFFFF"><?php echo $row_tabladetours['pilotid']; ?></td>
  110.       <td bgcolor="#FFFFFF"><?php echo $row_tabladetours['flightnum']; ?></td>
  111.       <td bgcolor="#FFFFFF"><?php echo $row_tabladetours['accepted']; ?><img src='http://argavirtual.com/lib/skins/templatemo_254_agency/images/vistobueno.gif'></td>
  112.     </tr>
  113.     <?php } while ($row_tabladetours = mysql_fetch_assoc($tabladetours)); ?>
  114. </table>
  115. <table border="5" align="right">
  116.   <tr>
  117.     <td bgcolor="#CC3300"><div align="center"><strong>ID de piloto ARV:</strong></div></td>
  118.     <td bgcolor="#CC3300"><div align="center"><strong>Nº de vuelo</strong></div></td>
  119.     <td bgcolor="#CC3300"><div align="center">
  120.       <p><strong>Completado</strong></p>
  121.       <p><strong>(0=no aceptado; 1=aceptado)</strong></p>
  122.     </div></td>
  123.   </tr>
  124.   <?php do { ?>
  125.     <tr>
  126.       <td bgcolor="#FFFFFF"><?php echo $row_tabladetours2['pilotid']; ?></td>
  127.       <td bgcolor="#FFFFFF"><?php echo $row_tabladetours2['flightnum']; ?></td>
  128.       <td bgcolor="#FFFFFF"><?php echo $row_tabladetours2['accepted']; ?><img src='http://argavirtual.com/lib/skins/templatemo_254_agency/images/vistobueno.gif'></td>
  129.     </tr>
  130.     <?php } while ($row_tabladetours2 = mysql_fetch_assoc($tabladetours2)); ?>
  131. </table>
  132. <table border="5" align="center">
  133.   <tr>
  134.     <td bgcolor="#CC3300"><strong>ID de piloto ARV:</strong></td>
  135.     <td bgcolor="#CC3300"><strong>Tour Completado</strong></td>
  136.   </tr>
  137.   <?php do { ?>
  138.   <tr>
  139.     <td bgcolor="#FFFFFF"><?php echo $row_Tablafinaltours['pilotid']; ?></td>
  140.     <td bgcolor="#FFFFFF"><?php echo $row_Tablafinaltours['accepted']; ?><img src='http://argavirtual.com/lib/skins/templatemo_254_agency/images/vistobueno.gif' /></td>
  141.   </tr>
  142.   <?php } while ($row_Tablafinaltours = mysql_fetch_assoc($Tablafinaltours)); ?>
  143. </table>
  144. <p>&nbsp;</p>
  145. <p>&nbsp;</p>
  146. <p>&nbsp;</p>
  147. </body>
  148. </html>
  149. <?php
  150. mysql_free_result($tabladetours);
  151. mysql_free_result($tabladetours2);
  152. mysql_free_result($Tablafinaltours);
  153. ?>

Última edición por spark21; 02/03/2014 a las 13:38