如何更快地将mysql数据加载到jquery数据表中

时间:2013-04-30 16:27:56

标签: php jquery html mysql datatables

嗨我正在使用jquery datatable插件将mysql数据加载到它到目前为止它很好但是当记录更多时数据表加载相对较慢所以现在我被困在这里并且不知道必须是什么这样做可以帮助我 这是我的代码

<?php
$result = mysql_query("SELECT * FROM `mdb` ORDER BY grno");
?>
$(document).ready(function(){
    $('#datatables').dataTable({
        "sPaginationType":"full_numbers",
        "aaSorting":[[2, "desc"]],
        "bJQueryUI":true
    });
})

<table id="datatables" class="display">
    <thead>
        <tr>
           <th>Srno.</th>
           <th>Brno.</th>
           <th>Name</th>
           <th>Address</th>
           <th>City</th>
           <th>Pin</th>
           <th>Mobile</th>
           <th>Actions</th>

        </tr>
    </thead>
    <tbody>
        <?php
           while ($row = mysql_fetch_array($result)) {
               echo "<tr>";
               echo "<td align='center'>$row[grno]</td>";
               echo "<td align='center'>$row[brno]</td>";
               echo "<td align='center'>$row[name]</td>";
               echo "<td align='center'>$row[address]</td>";
               echo "<td align='center'>$row[city]</td>";
               echo "<td align='center'>$row[pin]</td>";
               echo "<td align='center'>$row[mobile]</td>";
               echo "<td><a href=\"entry.php?vouchno=$row[vouchno]\"><img src='images/edit.png'></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"delete.php?code=$row[vouchno]\" onClick=\"return confirm('Confrim Delete?');\"><img src='images/delete.png'></a></td>";
               echo "</tr>";
           }
           ?>
    </tbody>
</table> 

1 个答案:

答案 0 :(得分:1)

请查看here

如果您想进行服务器端处理,请点击here