DevTech Posted June 11, 2022 Share Posted June 11, 2022 bonjour tous le monde, je suis entrain de creer une page ou je veut afficher un tableau contenant les donnée d'une table sql server 2017.le probleme c'est j'arrive pas a les affiché..quelqun peut m'aider a resooudre ce probleme <!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> <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>Order</th> <th>Box NR</th> </tr> </thead> <tbody> <?php error_reporting(E_ALL); ini_set('display_errors', '1'); $serverName = "SRV"; //serverName\instanceName $connectionInfo = array( "Database"=>"phils", "UID"=>"sa", "PWD"=>"Passw0rd"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Connexion établie.<br />"; }else{ echo "La connexion n'a pu être établie.<br />"; die( print_r( sqlsrv_errors(), true)); } function ReadData() { try { $conn = OpenConnection(); $tsql = "SELECT Code à Barres, Article, Désignation, Quantité par Unité, Quantité Totale, Groupe2, Propriété3, OF, NUMORDRE, NUMPALETTE FROM phils.Ligne Livraison Client réf"; $getProducts = sqlsrv_query($conn, $tsql); if ($getProducts == FALSE) die(FormatErrors(sqlsrv_errors(),TRUE)); $productCount = 0; while($row = sqlsrv_fetch_array($getProducts, SQLSRV_FETCH_ASSOC)) { echo "Code à Barres: ".$row[0]."\n"; echo "Article: ".$row[1]."\n"; echo "Désignation: ".$row[2]."\n"; echo "Quantité par Unité: ".$row[3]."\n"; echo "Quantité Totale: ".$row[4]."\n"; echo "Groupe2: ".$row[5]."\n"; echo "Propriété3: ".$row[6]."\n"; echo "OF: ".$row[7]."\n"; echo "NUMORDRE: ".$row[8]."\n"; echo "NUMPALETTE: ".$row[9]."\n"; echo "-----------------\n"; $productCount++; } sqlsrv_free_stmt($getProducts); sqlsrv_close($conn); } catch(Exception $e) { echo("Error!"); } } ?> </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/314914-problem-displaying-data-in-php-form/ Share on other sites More sharing options...
mac_gyver Posted June 11, 2022 Share Posted June 11, 2022 (edited) En anglais s'il vous plaît There's no code in your code to call the ReadData() function. The result you are getting is just the static html markup with the DataTable javascript/css applied to it. Edited June 11, 2022 by mac_gyver Quote Link to comment https://forums.phpfreaks.com/topic/314914-problem-displaying-data-in-php-form/#findComment-1597196 Share on other sites More sharing options...
mac_gyver Posted June 11, 2022 Share Posted June 11, 2022 the subject in this thread is the same as in your previous thread, just with a different database extension and a different problem in why there's no output. i recommend that you continue this in the previous thread, since the PDO database extension being used in it is superior to the sqlsrv extension. Quote Link to comment https://forums.phpfreaks.com/topic/314914-problem-displaying-data-in-php-form/#findComment-1597200 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.