通过使用php从html表中选择每一列来显示结果

通过使用php从html表中选择每一列来显示结果,php,html,mysql,excel,Php,Html,Mysql,Excel,是否有可能在html表的每一列中都有过滤选项,其中的数据是从mysql获取的,就像我们在excel工作表中所做的那样 <html> <?php // connect to the database include('connect-db.php'); $result = mysql_query("SELECT * FROM log WHERE type='c' ") ; echo "<div style='height:auto;'>

是否有可能在html表的每一列中都有过滤选项,其中的数据是从mysql获取的,就像我们在excel工作表中所做的那样

<html>
<?php
    // connect to the database
    include('connect-db.php');

    $result = mysql_query("SELECT * FROM log WHERE type='c' ") ;
    echo "<div style='height:auto;'><table border='0' cellpadding='10' class='table table-striped table-bordered'>";
    echo "<tr> <th>ID</th> <th>Date</th> <th>Type</th> <th>Batch name</th> <th>No.of Pages</th> <th>User</th><th>file</th><th>Status</th><th></th><th></th></tr>";


    // loop through results of database query, displaying them in the table
    while($row = mysql_fetch_array( $result )) {
        $id=$row['batch_file'];
        // echo out the contents of each row into a table
        echo "<tr>";
        echo '<td>' . $row['id'] . '</td>';
        echo '<td>' . $row['assdate'] . '</td>';
        echo '<td>' . $row['type'] . '</td>';
        echo '<td>'.substr($row['batch_file'], 0, -4).'</td>';
        echo '<td>' . $row['no_pages'] . '</td>';
        echo '<td>' . $row['assign'] . '</td>';
        echo '<td><a href="copy_test_uploads/'.$row['batch_file'].'"target="_blank"><img src="pdf.png" style=width:35px;></td>';
        echo '<td>' . $row['status'] . '</td>';
        echo '<td><a href="controllogviewedit.php?id=' . $row['id'] . '">Edit</a></td>';
        echo '<td><a href="controllogviewdelete.php?id=' . $row['id'] . '">Delete</a></td>';
        echo "</tr>"; 

    } 

    // close table>
    echo "</table></div>";
?>
</html>


为什么要使用过时的mysql_*函数?我建议您尝试一下
jQuery DataTables-单列搜索(选择输入)
,这样您可以编写更少的代码并加快开发速度。此外,DataTables非常棒。@Synchro。我对开发完全是新手。Php是我开发的第一件事。我不知道它的优点和缺点。我专注于我现在期望的功能。我想知道是否可以像在Excel中那样过滤html表。这是需要做的。我不确定这是否可能。如果可能,请给出一个服务器端筛选的简单示例。@Kstro21。感谢您向我推荐该链接。但不幸的是,我无法使用它。因为我需要服务器端筛选。