IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

question lecture de fichier dans lecture de fichier possible ou pas ?


Sujet :

Langage PHP

  1. #21
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    216
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Ardèche (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2016
    Messages : 216
    Points : 90
    Points
    90
    Par défaut
    pour la dernier ligne je sais mais j'ai jamais réussi a trouver comment faire
    car je sais pas ou je doit la supprimer ( sur quel page de code)

  2. #22
    Invité
    Invité(e)
    Par défaut
    Code php : 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
    function get_array_from_file( $fileURL )
    {
    	$lignes = array();
    	$array = array();
    	$sep = '|'; // séparateur
    	$handle = @fopen($fileURL, "r" );
    	if ($handle)
    	{
    	   while (!feof($handle))
    	   {
    		 $buffer = fgets($handle, 4096);
    		 $lignes[] = $buffer;
    	   }
    	   fclose($handle);
    	}
    	// on sépare les composants de chaque ligne
    	foreach( $lignes as $ligne)
    	{
    		if( !empty(trim($ligne)) ){ // on ignore les lignes vides
    			$array[] = array_map( 'trim', explode( $sep, $ligne ) ); // (trim) on supprime aussi les espaces et sauts de ligne inutiles
    		} 
    	}
    	return $array;
    }

  3. #23
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    216
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Ardèche (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2016
    Messages : 216
    Points : 90
    Points
    90
    Par défaut
    Nom : Sans titre 2.jpg
Affichages : 83
Taille : 157,9 Ko
    ça marche un peu mieux mais veux toujours pas ce con :'(
    il refuse tjr d'afficher les info :/

  4. #24
    Invité
    Invité(e)
    Par défaut
    Et les lignes 66 / 77 sont... ?

  5. #25
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    216
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Ardèche (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2016
    Messages : 216
    Points : 90
    Points
    90
    Par défaut
    mes echo :/

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <?php echo $array_produits[1]; ?>
    ligne 66

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <?php echo $array_produits[1]; ?>
    ligne 77

    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
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    <?php if(session_id()=='') { session_start(); } // TOUJOURS EN HAUT DE SCRIPT
    	header('Content-type:text/html; charset=UTF-8');	// encodage UTF-8
    	// --------------------------------------
    	// protection page admin
    	// --------------------------------------
    	// si session vide = PAS connecté
    	if( empty($_SESSION['admin']['login']))
    		{
    			// on redirige
    			header('location:../elements_inchangeables/connexion_admin/connexion_admin.php');
    			exit;
    		}
    	include('txt_array.php');
    //<!------------------------------------------------------------------>
    //<!-- debut du menu -->
    //<!------------------------------------------------------------------>
    	include('menu_admin.php');
    ?>
    <!------------------------------------------------------------------>
    <!-- fin du menu -->
    <!------------------------------------------------------------------>
     
    <!DOCTYPE html>
    <html>
    	<head>
    		<title>info vente</title>
    		<meta charset="utf-8">
    		<link rel="stylesheet" type="text/css" href="../../../CSS/style_base.css" />
    		<link rel="stylesheet" type="text/css" href="../../../CSS/style_form.css" />
    	</head>
    	<body>
    		<div id="fond">
    			<div id="contenu">
    				<!-- debut du contenu de la partie sombre -->
    				<div class="barre_du_centre">
    					<p id="formulaire">
    						<table>
    							<tr>
    								<td colspan="4" class="h3">
    									<a>
    										achat jeux_d_action
    									</a>
    								</td>
    							</tr>
    							<?php
    							include('tbody.php');
    							?> 							
    							<tfoot>
    								<tr>
    									<?php								
    										$array_achats = get_array_from_file( '../../../txt/genre/achat/jeux_d_aventures.txt' );
    										$array_utilisateurs = get_array_from_file( '../../../txt/Fichier_user.txt' );
    										$array_produits = get_array_from_file( '../../../txt/genre/jeux_d_aventures.txt' );
     
    										foreach ($array_achats as $i => $achat)
    										{
    											foreach ($array_produits as $j => $produit)
    											{
    												if ($achat[0] === $produit[0] )
    												{
    										?>
    													<td>
    														<img src="<?php echo $array_produits[3]; ?>" alt="" />
    													</td>
    													<td style="color:white;">
    														<?php echo $array_produits[1]; ?>
    													</td>
    										<?php
    												}
    											}
    											foreach ($array_utilisateurs as $k => $utilisateur)
    											{
    												if ($achat[1]=== $utilisateur[0] )
    												{
    										?>
    													<td style="color:white;">
    														<?php echo $array_produits[1]; ?>
    													</td>
    										<?php
    												}
    											}
    										}
    										?>  								
    							</tfoot>
     
    						</table>
    					</p>
    				</div>
    			</div>
    			<!------------------------------------------------------------------------------------------------------------------------------------>
    			<!-- fin du contenu de la partie sombre -->
    			<!------------------------------------------------------------------------------------------------------------------------------------>
    		</div>
    	</body>
    </html>
    <!------------------------------------------------------------------------------------------------------------------------------------>
    <!-- debut du footer -->
    <!------------------------------------------------------------------------------------------------------------------------------------>
    <?php
    include('footer_admin.php');
     
    //<!------------------------------------------------------------------------------------------------------------------------------------>
    //<!-- fin du footer -->
    //<!------------------------------------------------------------------------------------------------------------------------------------>
    ?>
    je remet mon code total

    et j'avais pas vu l'erreur se prolonge latéralement

    Notice: Array to string conversion in C:\xampp\htdocs\projet-web-dynamique-soulier-joris\PHP\site_connexion_admin\info_achat\achat_genre.php on line 66
    Array
    Notice: Array to string conversion in C:\xampp\htdocs\projet-web-dynamique-soulier-joris\PHP\site_connexion_admin\info_achat\achat_genre.php on line 77
    Array
    Notice: Array to string conversion in C:\xampp\htdocs\projet-web-dynamique-soulier-joris\PHP\site_connexion_admin\info_achat\achat_genre.php on line 66
    Array
    Notice: Array to string conversion in C:\xampp\htdocs\projet-web-dynamique-soulier-joris\PHP\site_connexion_admin\info_achat\achat_genre.php on line 77
    Array
    Notice: Array to string conversion in C:\xampp\htdocs\projet-web-dynamique-soulier-joris\PHP\site_connexion_admin\info_achat\achat_genre.php on line 66
    Array
    Notice: Array to string conversion in C:\xampp\htdocs\projet-web-dynamique-soulier-joris\PHP\site_connexion_admin\info_achat\achat_genre.php on line 77
    Array
    Notice: Array to string conversion in C:\xampp\htdocs\projet-web-dynamique-soulier-joris\PHP\site_connexion_admin\info_achat\achat_genre.php on line 66
    Array
    Notice: Array to string conversion in C:\xampp\htdocs\projet-web-dynamique-soulier-joris\PHP\site_connexion_admin\info_achat\achat_genre.php on line 77
    Array

  6. #26
    Invité
    Invité(e)
    Par défaut
    echo $produit[1];

    Relis MON code (message #14)

  7. #27
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    216
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Ardèche (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2016
    Messages : 216
    Points : 90
    Points
    90
    Par défaut
    =.= suis un abrutie .......
    merci cela marche nickel chrome

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 2 PremièrePremière 12

Discussions similaires

  1. Réponses: 4
    Dernier message: 28/08/2007, 17h11
  2. stocker/archiver plusieurs fichiers dans un seul fichier
    Par tatoo59 dans le forum VC++ .NET
    Réponses: 1
    Dernier message: 03/06/2007, 18h57
  3. Réponses: 1
    Dernier message: 15/05/2007, 16h55
  4. include fichier dans une autre fichier
    Par MSM_007 dans le forum C
    Réponses: 3
    Dernier message: 07/04/2007, 09h11
  5. enregistrer deux fichier dans un seul fichier
    Par Bourak dans le forum Langage
    Réponses: 9
    Dernier message: 05/11/2005, 09h48

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo