Bonjour
je voudrais parser un fichier de la façon suivante.
le problème étant que quand je passe en html, je n'obtiens que la première ligne de donnée alors qu'il y en a un 20taine
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 foreach ($requete as $req) { if(!file_exists("../tmp/".$req))// created a folder for each query mkdir ("../tmp/".$req, 0777); $requete_word = ('...... > ../tmp/'.$req.'/fetch.txt') ; exec($requete_word); $result_requete= ""; </td> $file = fopen("../tmp/".$req."/fetch.txt", "r") or die("<strong>problème d'ouverture fichier</strong>"); if ($file) { while (!feof($file)) { $result_requete= $result_requete.fgets($file, 4096); list($_SESSION['requete'][$req]['ID'], $_SESSION['requete'][$req]['KW'],.....) = explode(' % ',$result_requete); //print($_SESSION['requete'][$req]['KW']); } fclose($file); } }
En html pour l'affichage jj'ai fait
Où me suis je plantée ????
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 foreach(array_keys($_SESSION['requete']) as $nom => $req){ $trouves=preg_match("/HBG[0-9]{6}/",$_SESSION['noms'][$nom]);//verifying that the request is the HBG000000 type if($_SESSION['requete'][$req]['ID'] == 'none' || sizeof($trouves)==0 ){//verifying that the request is not empty and correct type print(' <table class="warning" border="0" cellspacing="0"> <tbody> <tr> <td class="warning">Cette requete n\'est pas réalisable : '.$_SESSION['noms'][$nom].'</td> </tr> </tbody> </table> '); } else{ echo ' <tr> <td align="center" bgcolor="#999999"> <table border="0" cellspacing="0" cellpadding="1"> <tr> <td align="center" valign="top"> <span class="h3_like"><BIG> '. $_SESSION['requete'][$req]['ID'].' </BIG></span> <a target="_blank" href="..."..></a> </td> </tr> </table> </td> </tr> <td border="0" cellpadding="0" cellspacing="0" width="460"> <p> '.nl2br($_SESSION['requete'][$req]['KW']).' </p></td> ';
Partager