Ouverture projet avec fichier index.html

Résolu/Fermé
JC_8280 Messages postés 78 Date d'inscription jeudi 19 mars 2020 Statut Membre Dernière intervention 7 février 2021 - 23 déc. 2020 à 12:09
jordane45 Messages postés 38144 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 21 avril 2024 - 23 déc. 2020 à 19:11
Bonjour,

Mon projet fonctionne avec une page d' accueil ***.php, mais j' ai voulu créer une page d' accueil index.html pour pouvoir lancer le projet en double click sur index.html.

Problème: le projet ne se lance pas correctement. Il semble qu'il y 'ait un problème de connection à la base de données, et/ou dans le Java Script avec les "include" ne se faisant pas correctement car "creation is null".

Quel est l'origine du problème?



Configuration: Windows / Firefox 84.0


Ci-joint programmes.

Programme Index.html
<!DOCTYPE HTML>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">    
  </head>
    <body>     
        <p> <a href="Hydro_01_avec_Index.php" target="_blank">OUTILS</a></p>        
   </body>  
</html>


Programme Hydro_01_avec_Index.php

<link rel="stylesheet" href="STYLE.css"/>
<title>OUTILS COUPANTS HYDRO CHATEAUROUX</title>  
    
   
    <?php include 'entete.php'; ?>
    <?php include 'creation.php'; ?> 
    <?php include 'recherche.php'; ?>
    <?php include 'modification.php'; ?>
   
<!--  ******************************************************** -->
<!--  *****    AFFICHAGE  DE LA TABLE OUTIL COMPLETE    ****** -->
<!--  ******************************************************** -->    

    
<?php   
        $serveur = "localhost";
        $login = "root";
        $pass = "";
        
        try{
            $connexion = new PDO("mysql:host=$serveur;dbname=hydro", $login, $pass);
            $connexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            
                    
          $requete = $connexion->prepare("
                SELECT*FROM cutting_tools_01");
                
          $requete->execute();      // sans affichage
          
          $resultat = $requete->fetchAll();
        }
                
        catch(PDOException $e){
            echo 'Echec : ' .$e->getMessage();
        }   
?>      
          
      <table id='table_outils'>
         <thead>
            <tr>
              <th>N° ordre</th>
              <th>Réference magasin</th>
              <th>Famille</th>
              <th>Sous-famille</th>
              <th>Matière</th>
              <th>Nombre de dents</th>
              <th>Ø1</th>
              <th>Longueur 1</th>
              <th>Ø2</th>
              <th>Ø3</th>
              <th>Longueur taillée</th>
              <th>Longueur totale</th>
              <th>Caractéristique 1</th>
              <th>Caractéristique 2</th>
              <th>Fournisseur</th>
              <th>Référence fournisseur</th>
              <th>Prix</th>
              <th>Quantité à stocker</th>
              <th>Cas emploi 1</th>
              <th>Cas emploi 2</th>
              <th>Cas emploi 3</th>
              <th>Cas emploi 4</th>
              <th>Cas emploi 5</th>
              <th>Cas emploi 6</th>
            </tr>
        </thead>
        <tbody>
<?php                    
    foreach($resultat as $row){
?>                
            <tr class = "tableRow" id = '<?php echo $row['id']?>'>
              <td><a href="DOCUMENTS_OUTILS/<?php echo $row['id']?>" target="_blank"><?php echo $row['id'];?></a></td>
              <td><?php echo $row['REF_MAG'];?></td>
              <td><?php echo $row['FAMILLE_OUTIL'];?></td>
              <td><?php echo $row['SOUS_FAMILLE'];?></td>
              <td><?php echo $row['MATIERE_OUTIL'];?></td> 
              <td><?php echo $row['NBRE_Z'];?></td>
              <td><?php echo $row['DIA_1'];?></td>
              <td><?php echo $row['LONGUEUR_1'];?></td>
              <td><?php echo $row['DIA_2'];?></td>
              <td><?php echo $row['DIA_3'];?></td> 
              <td><?php echo $row['LONG_UTILE'];?></td>
              <td><?php echo $row['LONG_TOTALE'];?></td>
              <td><?php echo $row['CARACT_1'];?></td>
              <td><?php echo $row['CARACT_2'];?></td>
              <td><?php echo $row['FOURNISSEUR'];?></td> 
              <td><?php echo $row['REF_FOURNISSEUR'];?></td>
              <td><?php echo $row['PRIX'];?></td>
              <td><?php echo $row['QTE_MINI'];?></td>
              <td><?php echo $row['CAS_EMPLOI_1'];?></td>
              <td><?php echo $row['CAS_EMPLOI_2'];?></td> 
              <td><?php echo $row['CAS_EMPLOI_3'];?></td>
              <td><?php echo $row['CAS_EMPLOI_4'];?></td>
              <td><?php echo $row['CAS_EMPLOI_5'];?></td>
              <td><?php echo $row['CAS_EMPLOI_6'];?></td>                                
            </tr>
<?php
    }
    
$connexion = null;     
?>
        </tbody>
        <tfoot> 
            <tr>
              <td colspan='3'>Nombre de references</td>
              <td>valeur</td>
            </tr>
        </tfoot>
      </table>
      
<!--  *****************  PIED DE PAGE  ******************** -->      
<?php include 'footer.php'; ?>


<!--  ******************************************************** -->
<!--  *****                     SCRIPTS                  ****** -->
<!--  ******************************************************** -->    
      
       <script id='scpript_JS' src = "GESTION_OUTILS.js" > </script>



Programme Entete.php
 <body>
    <h1>BASE DE GESTION DES OUTILS COUPANTS</h1>
    <div class='classButton' id='divButton'>
      <button class='bouton_creer' id='creer'>CREER UNE NOUVELLE REFERENCE</button>
      <button class='bouton_chercher' id='chercher'>RECHERCHE PAR FILTRES</button>
      <button class='bouton_modifier' id='modifier'>MODIFIER UNE REFERENCE</button>
      
      <form id='reset' class='bouton_reset' action="raz.php"  method="get">
      <input class='bouton_reset' type = "button" value = "RESET">         
      </form>
  
    </div>
  </body>



Merci d'avance.
JCT
A voir également:

2 réponses

jordane45 Messages postés 38144 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 21 avril 2024 4 650
23 déc. 2020 à 12:27
Bonjour,


pour pouvoir lancer le projet en double click sur index.html.

Cette phrase me fait peur .......

Pour que le PHP puisse être exécuté, il faut qu'il soit lancé sur un serveur.....
Si tu travailles en LOCAL sur ton ordi, tu dois utiliser un logiciel pour émuler ce serveur. ( LARAGON, WAMP, XAMPP, EASYPHP ..) (dans ton cas, tu utilises wamp visiblement)
Et donc, pour pouvoir afficher ta page, tu dois passer par l'URL de celle ci dans ton navigateur.
Url, qui en local, doit ressembler à http://localhost/tapage.php

Bref; comme tu peux le voir dans tes captures écrans.. le chemin vers le fichier n'est pas le bon.. vu que tu pointes vers c:\wamp64\ .....

l

1
JC_8280 Messages postés 78 Date d'inscription jeudi 19 mars 2020 Statut Membre Dernière intervention 7 février 2021
23 déc. 2020 à 18:55
Pourquoi cette phrase te fait peur ? ????
Cordialement.
JC T
0
jordane45 Messages postés 38144 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 21 avril 2024 4 650 > JC_8280 Messages postés 78 Date d'inscription jeudi 19 mars 2020 Statut Membre Dernière intervention 7 février 2021
23 déc. 2020 à 19:11
Au moment où j'ai écrit ça je n'avais pas encore regardé le contenu de ta capture d'écran et j'avais bien peur que tu aies fait l'erreur que justement... Tu as fait...
0
JC_8280 Messages postés 78 Date d'inscription jeudi 19 mars 2020 Statut Membre Dernière intervention 7 février 2021
23 déc. 2020 à 12:36
Encore une fois Merci...
0