Jump to content

display result sql server on php & html


DevTech

Recommended Posts

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>

 

Link to comment
Share on other sites

  • 2 weeks later...
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>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.