0

Hi friends,

I am using MSSQL Database, it has more than 13246 reconds in a table.

I am trying to display it in a table with bootstrap. But i am unable to load my datas.

can any please help me how to resolve this

my code is below

<?php
session_start();
include('conn.php');
if (!isset($_SESSION['username'])) {
       header('Location: index.php');
}
$username = $_SESSION['username'];

ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

function jde_date_conv($jde_date)
    {
        $ct = substr($jde_date,0,1);
        $yr = substr($jde_date,1,2);
        $dy = substr($jde_date,3,3);

        if($ct == 0)$yr_pfx=19;
        if($ct == 1)$yr_pfx=20;

        $tlt_yr = $yr_pfx.$yr;

        $base_time = mktime(0,0,0,1,0,$tlt_yr);

        $unix_time = ($dy*86400)+$base_time;

        return date("m-d-Y",$unix_time);
    }

    function setMyValue ($myValue) 
        {
            $newValue = (int)$myValue;
            $myArray = array_reverse(str_split($newValue));
            $myValue ="";
        foreach ($myArray as $key=>$myDigits) 
            {
                $myValue.=($key>0 && $key%2==0) ? ":" : "";
                $myValue.= $myDigits;
            }
        return strrev($myValue);

        }

?>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="images/icon.png">
<title>Smart Scheduler | Transaction | Transaction Report</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,400italic,700,800' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Raleway:300,200,100' rel='stylesheet' type='text/css'>

<!-- Bootstrap core CSS -->
<link href="js/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="js/jquery.gritter/css/jquery.gritter.css" />
<link rel="stylesheet" href="fonts/font-awesome-4/css/font-awesome.min.css">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
      <script src="../../assets/js/html5shiv.js"></script>
      <script src="../../assets/js/respond.min.js"></script>
    <![endif]-->
<link rel="stylesheet" type="text/css" href="js/jquery.nanoscroller/nanoscroller.css" />
<link rel="stylesheet" type="text/css" href="js/jquery.datatables/bootstrap-adapter/css/datatables.css" />
<link rel="stylesheet" type="text/css" href="js/bootstrap.switch/bootstrap-switch.css" />
<link rel="stylesheet" type="text/css" href="js/bootstrap.datetimepicker/css/bootstrap-datetimepicker.min.css" />
<link href="js/jquery.icheck/skins/flat/green.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet" />
</head>
<body>
<div id="cl-wrapper">
  <div class="cl-sidebar">
    <?php include('leftside.php'); ?>
  </div>
  <div class="container-fluid" id="pcont">
    <?php include("header.php"); ?>
    <div class="cl-mcont">
      <div class="page-head">
        <ol class="breadcrumb">
          <li><a href="#">Home</a></li>
          <li>Transaction</li>
          <li class="active">Transaction Report</li>
        </ol>
      </div>
      <div class="row">
        <div class="block-flat">
          <div class="header">
            <h3>Transaction Report</h3>
          </div>
          <div class="content">
            <div class="table-responsive">
              <table class="table table-bordered" id="datatable">
                <thead>
                  <tr>
                    <th rowspan="2"><div align="center">Unique Key Id</div></th>
                    <th rowspan="2"><div align="center">Stream Id</div></th>
                    <th colspan="2"><div align="center">Next Run</div></th>
                    <th rowspan="2"><div align="center">Line Number</div></th>
                    <th rowspan="2"><div align="center">Object Name</div></th>
                    <th rowspan="2"><div align="center">Version</div></th>
                    <th rowspan="2"><div align="center">Third Party Job</div></th>
                    <th rowspan="2"><div align="center">Multi Dependency</div></th>
                  </tr>
                  <tr>
                    <th><div align="center">Date</div></th>
                    <th><div align="center">Time</div></th>
                  </tr>
                </thead>
                <tbody>
                  <?php 

                                                $strSQL = "select * from $database.FQ64004 order by SSYQ64LRDT,SSYQ64TJBS ASC";
                                                $objExec = odbc_exec($connection, $strSQL);

                                                while($objResult = odbc_fetch_array($objExec))
                                                {
                                                    $ssid = $SSYQ64SID = $objResult["SSYQ64SID"];
                                                    $uqid = $SSYQ64UKID = $objResult["SSYQ64UKID"];

                                                    $s645 = "select * from $database.FQ64005 where SSYQ64UKID='$uqid'";
                                                    $result64 = odbc_exec($connection,$s645);

                                                    while(odbc_fetch_row($result64))
                                                    {
                                                        $fsid= odbc_result($result64,"SSYQ64SID");
                                                        $obnm= odbc_result($result64,"SSYQ64OBNM");
                                                        $ver= odbc_result($result64,"SSYQ64VER");

                                                        //Multidependency

                                                        $mdsql="select * from $database.FQ64003 where SEYQ64SID='$fsid'";
                                                        $mdres= odbc_exec($connection,$mdsql);

                                                        //SSYQ64UKID,SSYQ64SID,SSYQ64LRDT,SSYQ64TJBS,SSYQ64LNID,
                                            ?>
                  <tr>
                    <td align="center"><?php $SSYQ64UKID = $objResult["SSYQ64UKID"]; echo $ukid =intval($SSYQ64UKID);?></td>
                    <td align="center"><?php $SSYQ64SID = $objResult["SSYQ64SID"]; echo $sid =intval($SSYQ64SID); ?></td>
                    <td align="center"><?php $SSYQ64LRDT = $objResult["SSYQ64LRDT"]; if($SSYQ64LRDT==0) echo '-'; else echo jde_date_conv($SSYQ64LRDT); ?></td>
                    <td><?php $SSYQ64TJBS = $objResult["SSYQ64TJBS"]; echo setMyValue($SSYQ64TJBS); ?></td>
                    <td align="center"><?php $SSYQ64LNID = odbc_result($result64,"SSYQ64LNID"); echo number_format($SSYQ64LNID,0,'','.'); ?></td>
                    <td align="center"><?php echo $SSYQ64OBNM = odbc_result($result64,"SSYQ64OBNM"); ?></td>
                    <td><?php echo $SSYQ64VER  = odbc_result($result64,"SSYQ64VER"); ?></td>
                    <td  align="center"><?php echo $SSYQ64PGM = odbc_result($result64,"SSYQ64PGM"); ?></td>
                    <td align="center"><?php if(odbc_fetch_row($mdres)>0) echo 'Y'; else echo 'N'; ?></td>
                  </tr>
                  <?php  } } ?>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</body>
<script src="js/jquery.js"></script>
<script src="js/jquery.cookie/jquery.cookie.js"></script>
<script src="js/jquery.pushmenu/js/jPushMenu.js"></script>
<script type="text/javascript" src="js/jquery.nanoscroller/jquery.nanoscroller.js"></script>
<script type="text/javascript" src="js/jquery.sparkline/jquery.sparkline.min.js"></script>
<script type="text/javascript" src="js/jquery.ui/jquery-ui.js" ></script>
<script type="text/javascript" src="js/jquery.gritter/js/jquery.gritter.js"></script>
<script type="text/javascript" src="js/behaviour/core.js"></script>
<script type="text/javascript" src="js/bootstrap.switch/bootstrap-switch.min.js"></script>
<script type="text/javascript" src="js/bootstrap.datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="js/jquery.select2/select2.min.js" ></script>
<script type="text/javascript" src="js/bootstrap.slider/js/bootstrap-slider.js" ></script>
<script type="text/javascript" src="js/jquery.icheck/icheck.min.js"></script>
<script type="text/javascript" src="js/jquery.datatables/jquery.datatables.min.js"></script>
<script type="text/javascript" src="js/jquery.datatables/bootstrap-adapter/js/datatables.js"></script>
<script type="text/javascript">
      //Add dataTable Functions

    $(document).ready(function(){
      //initialize the javascript
      //Basic Instance
      $("#datatable").dataTable();

      //Search input style
      $('.dataTables_filter input').addClass('form-control').attr('placeholder','Search');
      $('.dataTables_length select').addClass('form-control');    

       /* Formating function for row details */
        function fnFormatDetails ( oTable, nTr )
        {
            var aData = oTable.fnGetData( nTr );
            var sOut = '<table cellpadding="7" cellspacing="0" border="0" style="padding-left:50px;">';
            sOut += '<tr><td>Unique Key Id:</td><td>'+aData[2]+'</td></tr>';
            sOut += '<tr><td>Link to source:</td><td>Could provide a link here</td></tr>';
            sOut += '<tr><td>Extra info:</td><td>And any further details here (images etc)</td></tr>';
            sOut += '</table>';

            return sOut;
        }

        /*
         * Insert a 'details' column to the table
         */
        var nCloneTh = document.createElement( 'th' );
        var nCloneTd = document.createElement( 'td' );
        nCloneTd.innerHTML = '<img class="toggle-details" src="images/plus.png" />';
        nCloneTd.className = "center";

        $('#datatable2 thead tr').each( function () {
            this.insertBefore( nCloneTh, this.childNodes[0] );
        } );

        $('#datatable2 tbody tr').each( function () {
            this.insertBefore(  nCloneTd.cloneNode( true ), this.childNodes[0] );
        } );

        /*
         * Initialse DataTables, with no sorting on the 'details' column
         */
        var oTable = $('#datatable2').dataTable( {
            "aoColumnDefs": [
                { "bSortable": false, "aTargets": [ 0 ] }
            ],
            "aaSorting": [[1, 'asc']]
        });

        /* Add event listener for opening and closing details
         * Note that the indicator for showing which row is open is not controlled by DataTables,
         * rather it is done here
         */
        $('#datatable2').delegate('tbody td img','click', function () {
            var nTr = $(this).parents('tr')[0];
            if ( oTable.fnIsOpen(nTr) )
            {
                /* This row is already open - close it */
                this.src = "images/plus.png";
                oTable.fnClose( nTr );
            }
            else
            {
                /* Open this row */
                this.src = "images/minus.png";
                oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
            }
        } );

      $('.dataTables_filter input').addClass('form-control').attr('placeholder','Search');
      $('.dataTables_length select').addClass('form-control');    

    });
</script>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->

<script src="js/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.flot/jquery.flot.js"></script>
<script type="text/javascript" src="js/jquery.flot/jquery.flot.pie.js"></script>
<script type="text/javascript" src="js/jquery.flot/jquery.flot.resize.js"></script>
<script type="text/javascript" src="js/jquery.flot/jquery.flot.labels.js"></script>
2
Contributors
5
Replies
28
Views
2 Years
Discussion Span
Last Post by pritaeas
1
$strSQL = "select * from $database.FQ64004 order by SSYQ64LRDT,SSYQ64TJBS ASC";

This assumes a variable named $database is set. What value does it have?

I suggest you add error checking to see if your query fails.

0

You mean schema instead of table? Database is specified in the connection string IIRC.

Do you get any errors?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.