DevTech Posted May 30, 2022 Share Posted May 30, 2022 bonjour tous le monde j'ai un probleme avec sql server et php je n'arrive pas a faire affiché les donné sur mon tableau html..et j'ai rien trouvé sur google qui puisse m'aidé sur ce sujet...this is my index.php <?php require_once "config.php"; ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap4.min.css"> <title>Home</title> </head> <body> <h1>Liste Collisage</h1> <nav class="navbar navbar-light bg-light"> <a class="navbar-brand"> <pre>Delivery note Nr. <?php echo "" . date("Y/m/d") . "<br>";?></pre> <a> </nav> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <table id="dest_data" class="table table-striped table-bordered" style="width:100%"> <thead> <tr> <th>Code à Barres</th> <th>Article Name</th> <th>Désignation</th> <th>Quantity par Size</th> <th>Quantité Totale</th> <th>Article Number</th> <th>CRINGS Number</th> <th>Order Number</th> <th>Box NR</th> </tr> </thead> <tbody> <?php $sql = "SELECT Code à Barres,Article,Désignation,Quantité par Unité,Quantité Totale,Propriété3,OF,NUMORDRE, NUMPALETTE FROM dbo.Ligne Livraison Client réf"; $req = $dbh->query($sql); $result1 = $req->fetchAll(PDO::FETCH_ASSOC); { echo " <tr> <td>", $item['Code à Barres'], "</td> <td>", $item['Article'], "</td> <td>", $item['Désignation'], "</td> <td>", $item['Quantité par Unité'], "</td> <td>", $item['Quantité Totale'], "</td> <td>", $item['Propriété3'], "</td> <td>", $item['OF'], "</td> <td>", $item['NUMORDRE'], "</td> <td>", $item['NUMPALETTE'], "</td> </tr> ";} ?> </tbody> </table> </div> </div> </div> <script src="https://code.jquery.com/jquery-3.5.1.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script> <script> $('#dest_data').DataTable(); </script> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/314865-display-result-sql-server-on-php-html/ Share on other sites More sharing options...
Barand Posted May 30, 2022 Share Posted May 30, 2022 There appears to be a line missing from your code - the line where you take each row from your "$result1" and put them into "$item". For future reference, please post in English and tell us what the probem is and any error messages you might be getting. Quote Link to comment https://forums.phpfreaks.com/topic/314865-display-result-sql-server-on-php-html/#findComment-1596836 Share on other sites More sharing options...
DevTech Posted June 11, 2022 Author Share Posted June 11, 2022 On 5/30/2022 at 1:50 PM, DevTech said: Hello everyone, I am creating a page where I want to display a table containing the data of a sql server 2017 table. The problem is I cannot display them.. Can anyone help me solve this problem? <?php require_once "config.php"; ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap4.min.css"> <title>Home</title> </head> <body> <h1>Liste Collisage</h1> <nav class="navbar navbar-light bg-light"> <a class="navbar-brand"> <pre>Delivery note Nr. <?php echo "" . date("Y/m/d") . "<br>";?></pre> <a> </nav> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <table id="dest_data" class="table table-striped table-bordered" style="width:100%"> <thead> <tr> <th>Code à Barres</th> <th>Article Name</th> <th>Désignation</th> <th>Quantity par Size</th> <th>Quantité Totale</th> <th>Article Number</th> <th>CRINGS Number</th> <th>Order Number</th> <th>Box NR</th> </tr> </thead> <tbody> <?php $sql = "SELECT Code à Barres,Article,Désignation,Quantité par Unité,Quantité Totale,Propriété3,OF,NUMORDRE, NUMPALETTE FROM dbo.Ligne Livraison Client réf"; $req = $dbh->query($sql); $result1 = $req->fetchAll(PDO::FETCH_ASSOC); { echo " <tr> <td>", $item['Code à Barres'], "</td> <td>", $item['Article'], "</td> <td>", $item['Désignation'], "</td> <td>", $item['Quantité par Unité'], "</td> <td>", $item['Quantité Totale'], "</td> <td>", $item['Propriété3'], "</td> <td>", $item['OF'], "</td> <td>", $item['NUMORDRE'], "</td> <td>", $item['NUMPALETTE'], "</td> </tr> ";} ?> </tbody> </table> </div> </div> </div> <script src="https://code.jquery.com/jquery-3.5.1.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script> <script> $('#dest_data').DataTable(); </script> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/314865-display-result-sql-server-on-php-html/#findComment-1597197 Share on other sites More sharing options...
Barand Posted June 11, 2022 Share Posted June 11, 2022 You were told what was wrong 12 days ago - read your reply. Quote Link to comment https://forums.phpfreaks.com/topic/314865-display-result-sql-server-on-php-html/#findComment-1597198 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.