Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1100 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  Chaner le résultat d'une valeur dans array par une image

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Chaner le résultat d'une valeur dans array par une image

n°2235532
denis acf0​1
Posté le 13-08-2014 à 11:33:36  profilanswer
 

Bonjour,  
Jai un array qui m'affiche le résultat et j'aimerais changé le texte d'une valeur par une image  
exemple: affiche dans le tableau "pomme"  et a la place je voudrais http://dessinemoiunehistoire.net/wp-content/uploads/2013/02/dessin-pomme.png
 
y a t'il un moyen? merci
je veux modifier juste $matches[15]

Code :
  1. $connect = array();
  2. foreach ($file as $line)
  3. {
  4.     $line = trim($line);
  5.     if(false != preg_match("/([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:DafWings*]+)/", $line, $matches))
  6.     {
  7.         $connect[] = array(
  8.      $matches[15],
  9.      $matches[4],
  10.             $matches[2],
  11.             $matches[3],
  12.             $matches[12],
  13.             $matches[14],
  14.   $matches[10],
  15.         );
  16.     }
  17. }
  18. function array_remplace_value( $oldValue, $newValue, &$array ) { if( ! ( $key = array_search( $oldValue, $array ) ) || count( array_keys( $array, $key ) ) > [15] ) { return FALSE; } else { $array[$matches] = $newValue; return TRUE; } }
  19. /**
  20. * Ouverture du tableau HTML
  21. */
  22. $sTableau  = <<<CODE_HTML
  23.         <table>
  24.         <thead>
  25.     <tr>
  26.         <th class="style3" style="height: 7px; width: 7px;">Airline</th>
  27.         <th class="style3" style="height: 7px; width: 7px;">Function</th>
  28.  <th class="style3" style="height: 7px; width: 2px;">Callsign</th>
  29.  <th class="style3" style="height: 7px; width: 150px;">Name</th>
  30.  <th class="style3" style="height: 7px; width: 33px;">Departure</th>
  31.  <th class="style3" style="height: 7px; width: 31px;">Arrival</th>
  32.  <th class="style3" style="height: 7px; width: 9px;">Aircraft</th>
  33.             </tr>
  34.           </thead>
  35.           <tbody>
  36. CODE_HTML;
  37. /**
  38. * Construction des lignes du tableau
  39. */
  40. foreach($connect as $ligne):
  41.     $Airline    = htmlentities($ligne[0]);
  42.     $Function   = htmlentities($ligne[1]);
  43.     $callsign   = htmlentities($ligne[2]);
  44.     $name       = htmlentities($ligne[3]);
  45.     $Departure  = htmlentities($ligne[4]);
  46.     $Arrival    = htmlentities($ligne[5]);
  47. $Aircraft   = htmlentities($ligne[6]);
  48.     $sTableau .= <<<CODE_HTML
  49.             <tr>
  50.     <td class="style40" style="height: 9px; width: 9px;">{$Airline}</td>
  51.     <td class="style40" style="height: 9px; width: 9px;">{$Function}</td>
  52.               <td class="style40" style="height: 9px; width: 9px;">{$callsign}</td>
  53.               <td class="style40" style="height: 9px; width: 9px;">{$name}</td>
  54.               <td class="style40" style="height: 9px; width: 9px;">{$Departure}</td>
  55.               <td class="style40" style="height: 9px; width: 9px;">{$Arrival}</td>
  56.     <td class="style40" style="height: 9px; width: 9px;">{$Aircraft}</td>
  57.             </tr>
  58. CODE_HTML;
  59. endforeach;
  60. /**
  61. * Fermeture du tableau HTML
  62. */
  63. $sTableau .= <<<CODE_HTML
  64.           </tbody>
  65.         </table>
  66. CODE_HTML;
  67. $sTableau .= <<<CODE_HTML
  68.           </tbody>
  69.         </table>
  70. CODE_HTML;
  71. /**
  72. * Affichage du tableau HTML
  73. */
  74. echo($sTableau);
  75. ?>

mood
Publicité
Posté le 13-08-2014 à 11:33:36  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  Chaner le résultat d'une valeur dans array par une image

 

Sujets relatifs
affichage de résultat dans un interface JFrameEnregistrement checkbox dans Array
updater n lignes : combler des trousRécupếrer valeur qui change dans un formulaire en JQUERY
Comment changer la valeur de la variable bmaxdata pour un systèm32-bit[Réglé] [SQL] Une jointure avec le résultat de la requete
Ajout d'image MVCservlet pour l'affichage d'une image
Phpmyadmin importer imageChanger la valeur d'une cellule d'un "tableau"
Plus de sujets relatifs à : Chaner le résultat d'une valeur dans array par une image


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR