0
|
1 <?php
|
|
2 /* MySQL connection */
|
|
3 include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" ); /* ;-) */
|
|
4
|
|
5 $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
|
6 die( 'Could not open connection to server' );
|
|
7
|
|
8 mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
|
|
9 die( 'Could not select database '. $gaSql['db'] );
|
|
10
|
|
11 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
12 <html>
|
|
13 <head>
|
|
14 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
15 <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico" />
|
|
16
|
|
17 <title>DataTables example</title>
|
|
18 <style type="text/css" title="currentStyle">
|
|
19 @import "../../css/demo_page.css";
|
|
20 @import "../../css/demo_table.css";
|
|
21 </style>
|
|
22 <script type="text/javascript" language="javascript" src="../../js/jquery.js"></script>
|
|
23 <script type="text/javascript" language="javascript" src="../../js/jquery.dataTables.js"></script>
|
|
24 <script type="text/javascript" charset="utf-8">
|
|
25 $(document).ready(function() {
|
|
26 var oTable = $('#example').dataTable();
|
|
27 var iStart = new Date().getTime();
|
|
28
|
|
29 //if ( typeof console != 'undefined' ) {
|
|
30 // console.profile();
|
|
31 //}
|
|
32 for ( var i=0 ; i<10 ; i++ )
|
|
33 {
|
|
34 var oTable = $('#example').dataTable({"bDestroy": true});
|
|
35 }
|
|
36 //if ( typeof console != 'undefined' ) {
|
|
37 // console.profileEnd();
|
|
38 //}
|
|
39
|
|
40 //oTable.fnSort( [[ 1, 'asc' ]] );
|
|
41 //oTable.fnSort( [[ 1, 'asc' ]] );
|
|
42 //oTable.fnSort( [[ 2, 'asc' ]] );
|
|
43 //oTable.fnSort( [[ 1, 'asc' ]] );
|
|
44 //oTable.fnSort( [[ 2, 'asc' ]] );
|
|
45
|
|
46 var iEnd = new Date().getTime();
|
|
47 document.getElementById('output').innerHTML = "Test took "+(iEnd-iStart)+" mS";
|
|
48 } );
|
|
49 </script>
|
|
50 </head>
|
|
51 <body id="dt_example">
|
|
52 <div id="container">
|
|
53 <div class="full_width big">
|
|
54 <i>DataTables</i> performance test - draw
|
|
55 </div>
|
|
56 <div id="output"></div>
|
|
57
|
|
58 <div id="demo">
|
|
59 <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
|
60 <thead>
|
|
61 <tr>
|
|
62 <th>id</th>
|
|
63 <th>name</th>
|
|
64 <th>phone</th>
|
|
65 <th>email</th>
|
|
66 <th>city</th>
|
|
67 <th>zip</th>
|
|
68 <th>state</th>
|
|
69 <th>country</th>
|
|
70 <th>zip2</th>
|
|
71 </tr>
|
|
72 </thead>
|
|
73 <tbody>
|
|
74 <?php
|
|
75 $sQuery = "
|
|
76 SELECT *
|
|
77 FROM testData
|
|
78 LIMIT 2000
|
|
79 ";
|
|
80 $rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
|
81 while ( $aRow = mysql_fetch_array( $rResult ) )
|
|
82 {
|
|
83 echo '<tr>';
|
|
84 echo '<td><a href="1">'.$aRow['id'].'</a></td>';
|
|
85 echo '<td>'.$aRow['name'].'</td>';
|
|
86 echo '<td>'.$aRow['phone'].'</td>';
|
|
87 echo '<td>'.$aRow['email'].'</td>';
|
|
88 echo '<td>'.$aRow['city'].'</td>';
|
|
89 echo '<td>'.$aRow['zip'].'</td>';
|
|
90 echo '<td>'.$aRow['state'].'</td>';
|
|
91 echo '<td>'.$aRow['country'].'</td>';
|
|
92 echo '<td>'.$aRow['zip2'].'</td>';
|
|
93 echo '</tr>';
|
|
94 }
|
|
95 ?>
|
|
96 </tbody>
|
|
97 </table>
|
|
98 </div>
|
|
99 <div class="spacer"></div>
|
|
100
|
|
101 <div id="footer" style="text-align:center;">
|
|
102 <span style="font-size:10px;">
|
|
103 DataTables © Allan Jardine 2008-2009.
|
|
104 </span>
|
|
105 </div>
|
|
106 </div>
|
|
107 </body>
|
|
108 </html> |