Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------------- Table --------------------------------------
- <table id="data-table-buttons" class="table table-striped table-bordered">
- <thead>
- <tr>
- <!--<th width="1%" data-orderable="false"></th>-->
- <th class="text-nowrap">Id</th>
- <th class="text-nowrap">Data</th>
- <th class="text-nowrap">Loja</th>
- <th class="text-nowrap">Produto</th>
- <th class="text-nowrap">Qtde</th>
- <th class="text-nowrap">Vlr. Unit.</th>
- <th class="text-nowrap">Vlr. Total</th>
- </tr>
- </thead>
- </table>
- -------------------------------------- Script DataTable --------------------------------------
- <script type="text/javascript" language="javascript">
- $(document).ready(function() {
- $('#data-table-buttons').DataTable( {
- dom: 'Bfrtip',
- buttons: [
- 'copy', 'csv', 'excel', 'pdf', 'print'
- ],
- "processing": true,
- "serverSide": true,
- "ajax": {
- "url": "busca.php",
- "type": "POST"
- },
- "columns" : [ {
- "data" : "Id"
- }, {
- "data" : "data"
- }, {
- "data" : "loja"
- }, {
- "data" : "produto"
- },{
- "data" : "qtde"
- },{
- "data" : "vlrunitario"
- },{
- "data" : "vlrtotal"
- }]
- } );
- } );
- </script>
- -------------------------------------- PHP --------------------------------------
- Aqui eu não estou conseguindo montar pra...
- RAW Paste Data
- -------------------------------------- Table --------------------------------------
- <table id="data-table-buttons" class="table table-striped table-bordered">
- <thead>
- <tr>
- <!--<th width="1%" data-orderable="false"></th>-->
- <th class="text-nowrap">Id</th>
- <th class="text-nowrap">Data</th>
- <th class="text-nowrap">Loja</th>
- <th class="text-nowrap">Produto</th>
- <th class="text-nowrap">Qtde</th>
- <th class="text-nowrap">Vlr. Unit.</th>
- <th class="text-nowrap">Vlr. Total</th>
- </tr>
- </thead>
- </table>
- -------------------------------------- Script DataTable --------------------------------------
- <script type="text/javascript" language="javascript">
- $(document).ready(function() {
- $('#data-table-buttons').DataTable( {
- dom: 'Bfrtip',
- buttons: [
- 'copy', 'csv', 'excel', 'pdf', 'print'
- ],
- "processing": true,
- "serverSide": true,
- "ajax": {
- "url": "busca.php",
- "type": "POST"
- },
- "columns" : [ {
- "data" : "Id"
- }, {
- "data" : "data"
- }, {
- "data" : "loja"
- }, {
- "data" : "produto"
- },{
- "data" : "qtde"
- },{
- "data" : "vlrunitario"
- },{
- "data" : "vlrtotal"
- }]
- } );
- } );
- </script>
- -------------------------------------- PHP --------------------------------------
- <?php
- include("../conexao/conexao.php");
- $query = mysqli_query($conn, "select Id, data, loja, produto, qtde, vlrunitario, vlrtotal from vendas where loja=1 and data=20190102");
- $result = array();
- while ($rows = mysqli_fetch_assoc($query)) {
- $id = $rows['Id'];
- $data = $rows['data'];
- $loja = $rows['loja'];
- $produto = $rows['produto'];
- $qtde = $rows['qtde'];
- $vlrunitario = $rows['vlrunitario'];
- $vlrtotal = $rows['vlrtotal'];
- $result[] = array($id,$data,$loja,$produto,$qtde,vlrunitario,$vlrtotal);
- }
- }
- echo json_encode(array($result));
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement