Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- try
- {
- $user = "p.laurent";
- $pass = "passe";
- $odb = new PDO('mysql:host=172.16.99.3;dbname=p.laurent', $user, $pass);
- }
- catch(Exception $e)
- {
- die('Erreur : '.$e->getMessage());
- }
- ob_start();
- // Le contenu HTML – contenu du tampon de sortie - est mis dans une variable par
- //exemple : $content
- $nom = "Houdayer";
- $prenom='Pierre';
- $requete = $odb -> prepare('SELECT pointure, modele, stock FROM PPE2_STOCK INNER JOIN PPE2_PRODUIT ON PPE2_STOCK.numproduit=PPE2_PRODUIT.numproduit');
- $requete->execute();
- $content = "<page><b><h1 style='text-align: center;'>Gestion des stocks</h1></b><br />
- <table style='text-align: center;'>
- <tr>
- <th>Modèle</th>
- <th>Pointure</th>
- <th>Stock</th>
- </tr>";
- while($infosstock = $requete -> fetch())
- {
- $content .= "<tr>
- <td>" . $infosstock['modele'] . "</td>
- <td>" . $infosstock['pointure'] . "</td>
- <td>" . $infosstock['stock'] . "</td>
- </tr>";
- }
- $content .= "</table></page>";
- ob_end_clean();
- require_once("html2pdf-4.5.1/vendor/autoload.php"); //donner ici le chemin de autoload.php
- $html2pdf = new HTML2PDF('P','A4','fr');
- $html2pdf->WriteHTML($content);
- $html2pdf->Output('Facture.pdf');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement