Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/11/2015, 10:08
javierconesa23
 
Fecha de Ingreso: febrero-2011
Ubicación: Barcelona
Mensajes: 195
Antigüedad: 13 años, 2 meses
Puntos: 1
crear un bucle para leer varios registros en html

Hola buenas
estoy en una parte de webservice la cual me lee unas tablas con varios registros
Forma grafica:
http://postimg.org/image/956v9el2t

bien pues leo un webservice el cual me da dos linea sde registros pero en el php solo se me mestra una y si vuelvo a repetir las tablas me pinta la primera solo
Código PHP:
Ver original
  1. define('USERPWD', 'echidna\jconesa:jconesa');
  2. $empresa = '1 TPS-N_LAB';
  3. $baseURL = 'http://128.20.1.1:7047/DynamicsNAV/WS/';
  4. $pageURL = $baseURL.rawurlencode($empresa).'/Page/WTADistribucionesPorAutoriz';
  5. $NumCliente = '101222';  // deixar en blanc perque pregunti
  6.  
  7.  
  8. //-------------------------------------------------------------------------------------------------
  9. include("NTLMStream.php");  
  10. include("NTLMSoapClient.php");
  11.  
  12. // we unregister the current HTTP wrapper
  13. stream_wrapper_unregister('http');
  14. // we register the new HTTP wrapper
  15. stream_wrapper_register('http', 'NTLMStream') or die("Fallo al registrar protocolo");
  16.  
  17. // Initialize Page Soap Client
  18. $page = new NTLMSoapClient($pageURL);
  19. //-------------------------------------------------------------------------------------------------
  20.  
  21. /* if ($NumCliente == ''){
  22.   echo 'NumCliente? '; 
  23.   $NumCliente = fgets(STDIN);
  24. }
  25. echo "NumCliente: " . $NumCliente . PHP_EOL; */
  26. echo $cliente;
  27.  
  28.  
  29. $timeIni = time();
  30.  
  31. $params = array('filter' => array(
  32.                                     array('Field' => 'Cliente',
  33.                                           'Criteria' => $cliente)
  34.                                   ),
  35.                 'setSize' => 0);
  36. $result = $page->ReadMultiple($params);
  37. $distribuciones = $result->ReadMultiple_Result->WTADistribucionesPorAutoriz ;
  38.  
  39. /* echo 'Num_distribucion | Num_contrato | Cdad_disponible '; */
  40. //echo '| Cdad_existente'
  41. echo PHP_EOL;
  42. if (is_array($distribuciones)) {
  43.   foreach($distribuciones as $distrib) {
  44.    /*  echo $distrib->Num_distribucion . ' | ';
  45.     echo $distrib->Num_contrato . ' | ';
  46.     echo $distrib->Cdad_disponible ;
  47.     echo $distrib->Cdad_existente */
  48.        
  49.     echo PHP_EOL;
  50.    
  51.   }    
  52. }
  53. /* else {
  54.   echo $distribuciones->Num_distribución . PHP_EOL;
  55. }  */
  56. $ndistri = $distrib->Num_autorizacion;
  57. $clientes = $distrib->Cliente;
  58. $matriculat = $distrib->Matricula_tractora;
  59. $matricular = $distrib->Matricula_remolque;
  60. $dni = $distrib->DNI_conductor;
  61. $namedriver = $distrib->Nombre_conductor;
  62. $fecha = $distrib->Fecha;
  63. $hora = $distrib->Hora;
  64. $estado = $distrib->Estado;
  65. $contrato = $distrib->Contrato;
  66.  
  67. /* echo $ndistri. ' | ';
  68. echo $cliente. ' | ';
  69. echo $matriculat. ' | ';
  70. echo $matricular. ' | ';
  71. echo $dni. ' | ';
  72. echo $namedriver. ' | ';
  73. echo $fecha. ' | ';
  74. echo $hora. ' | ';
  75. echo $estado. ' | '; */
  76. //sleep(3);
  77. echo 'Respuesta en ';
  78. echo  time() - $timeIni . ' segundos' ;
  79. ?>
  80.  
  81. <table class="table table-bordered table-striped datatable" id="table-2">
  82.     <thead>
  83.         <tr>
  84.             <th>
  85.                 <div class="checkbox checkbox-replace">
  86.                     <input type="checkbox" id="chk-1">
  87.                 </div>
  88.             </th>
  89.             <th>Contrato</th>                                        
  90.             <th>Cliente</th>                                              
  91.             <th>Matricula Tractora</th>                            
  92.             <th>DNI PASAPORTE</th>                              
  93.             <th>Matricula Remolque</th>                          
  94.             <th>Nombre</th>                                            
  95.         </tr>
  96.     </thead>
  97.    
  98.     <tbody>
  99.         <tr>
  100.             <td>
  101.                 <div class="checkbox checkbox-replace">
  102.                     <input type="checkbox" id="chk-1">
  103.                 </div>
  104.             </td>
  105.             <td><?php echo $contrato;?></td>   <------------------------
  106.             <td><?php echo $clientes;?></td>     <-----------------------
  107.             <td><?php echo $matriculat;?></td> <----------------------
  108.             <td><?php echo $dni;?></td> <-------------------------------
  109.             <td><?php echo $matricular;?></td><-----------------------
  110.             <td><?php echo $namedriver;?></td><----------------------
  111.             <td>
  112.                 <a href="#" class="btn btn-default btn-sm btn-icon icon-left">
  113.                     <i class="entypo-pencil"></i>
  114.                     Edit
  115.                 </a>
  116.                
  117.                 <a href="#" class="btn btn-danger btn-sm btn-icon icon-left">
  118.                     <i class="entypo-cancel"></i>
  119.                     Delete
  120.                 </a>
  121.                
  122.                 <a href="#" class="btn btn-info btn-sm btn-icon icon-left">
  123.                     <i class="entypo-info"></i>
  124.                     Profile
  125.                 </a>
  126.             </td>
  127.         </tr>

bueno buscando creo que me extendido , seria hacer un foreach para crear las tablas exactamente donde indico.

Última edición por javierconesa23; 10/11/2015 a las 10:42