| 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 |
|
| 27 |
//if ( typeof console != 'undefined' ) { |
| 28 |
// console.profile(); |
| 29 |
//} |
| 30 |
var oTable = $('#example').dataTable(); |
| 31 |
//if ( typeof console != 'undefined' ) { |
| 32 |
// console.profileEnd(); |
| 33 |
//} |
| 34 |
|
| 35 |
var iStart = new Date().getTime(); |
| 36 |
|
| 37 |
oTable.fnSort( [[ 1, 'asc' ]] ); |
| 38 |
oTable.fnSort( [[ 1, 'asc' ]] ); |
| 39 |
oTable.fnSort( [[ 2, 'asc' ]] ); |
| 40 |
oTable.fnSort( [[ 1, 'asc' ]] ); |
| 41 |
oTable.fnSort( [[ 2, 'asc' ]] ); |
| 42 |
oTable.fnSort( [[ 1, 'asc' ]] ); |
| 43 |
oTable.fnSort( [[ 2, 'asc' ]] ); |
| 44 |
oTable.fnSort( [[ 1, 'asc' ]] ); |
| 45 |
oTable.fnSort( [[ 2, 'asc' ]] ); |
| 46 |
oTable.fnSort( [[ 1, 'asc' ]] ); |
| 47 |
oTable.fnSort( [[ 2, 'asc' ]] ); |
| 48 |
oTable.fnSort( [[ 1, 'asc' ]] ); |
| 49 |
oTable.fnSort( [[ 2, 'asc' ]] ); |
| 50 |
|
| 51 |
var iEnd = new Date().getTime(); |
| 52 |
document.getElementById('output').innerHTML = "Test took "+(iEnd-iStart)+" mS"; |
| 53 |
} ); |
| 54 |
</script> |
| 55 |
</head> |
| 56 |
<body id="dt_example"> |
| 57 |
<div id="container"> |
| 58 |
<div class="full_width big"> |
| 59 |
<i>DataTables</i> performance test - draw |
| 60 |
</div> |
| 61 |
<div id="output"></div> |
| 62 |
|
| 63 |
<div id="demo"> |
| 64 |
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> |
| 65 |
<thead> |
| 66 |
<tr> |
| 67 |
<th>id</th> |
| 68 |
<th>name</th> |
| 69 |
<th>phone</th> |
| 70 |
<th>email</th> |
| 71 |
<th>city</th> |
| 72 |
<th>zip</th> |
| 73 |
<th>state</th> |
| 74 |
<th>country</th> |
| 75 |
<th>zip2</th> |
| 76 |
</tr> |
| 77 |
</thead> |
| 78 |
<tbody> |
| 79 |
<?php |
| 80 |
$sQuery = " |
| 81 |
SELECT * |
| 82 |
FROM testData |
| 83 |
LIMIT 2000 |
| 84 |
"; |
| 85 |
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die('SQL error'); |
| 86 |
while ( $aRow = mysql_fetch_array( $rResult ) ) |
| 87 |
{ |
| 88 |
echo '<tr>'; |
| 89 |
echo '<td><a href="1">'.$aRow['id'].'</a></td>'; |
| 90 |
echo '<td>'.$aRow['name'].'</td>'; |
| 91 |
echo '<td>'.$aRow['phone'].'</td>'; |
| 92 |
echo '<td>'.$aRow['email'].'</td>'; |
| 93 |
echo '<td>'.$aRow['city'].'</td>'; |
| 94 |
echo '<td>'.$aRow['zip'].'</td>'; |
| 95 |
echo '<td>'.$aRow['state'].'</td>'; |
| 96 |
echo '<td>'.$aRow['country'].'</td>'; |
| 97 |
echo '<td>'.$aRow['zip2'].'</td>'; |
| 98 |
echo '</tr>'; |
| 99 |
} |
| 100 |
?> |
| 101 |
</tbody> |
| 102 |
</table> |
| 103 |
</div> |
| 104 |
<div class="spacer"></div> |
| 105 |
|
| 106 |
<div id="footer" style="text-align:center;"> |
| 107 |
<span style="font-size:10px;"> |
| 108 |
DataTables © Allan Jardine 2008-2009. |
| 109 |
</span> |
| 110 |
</div> |
| 111 |
</div> |
| 112 |
</body> |
| 113 |
</html> |