Как сделать поиск на сайте по базе данных

Как сделать поиск по бд через строку ввода на сайте , в бд таблица на 15 столбцов и только с текстовым наполнением количеством информации на 46 тысяч строк, результат в свою очередь должен отображаться в таблице

введите сюда описание изображения

вот код самой таблицы:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Каталог+</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
    <div id="tablewrapper">
        <div id="tableheader">
            <div class="search">
                <select id="columns" onchange="sorter.search('query')"></select>
                <input type="text" id="query" onkeyup="sorter.search('query')" />
            </div>
            <span class="details">
                <div>Records <span id="startrecord"></span>-<span id="endrecord"></span> of <span id="totalrecords"></span></div>
                <div><a href="javascript:sorter.reset()">reset</a></div>
            </span>
        </div>






        <table cellpadding="0" cellspacing="0" border="0" id="table" class="tinytable">

            <thead>

                    <tr>
                        <th><h3>Код згідно з НК 004</h3></th>
                        <th><h3>Позначення НД</h3></th>
                        <th><h3>Назва НД</h3></th>
                        <th><h3>чинність НД в Україні</h3></th>
                        <th><h3>Кількість сторінок в НД</h3></th>
                        <th><h3>Наявність змін та поправок до НД</h3></th>
                        <th><h3>Позначнення НД який замінено</h3></th>
                        <th><h3>Наказ про прийняття НД</h3></th>
                        <th><h3>Скасування</h3></th>
                        <th><h3>Мова</h3></th>
                        <th><h3>Метод прийняття</h3></th>
                        <th><h3>Технічний комітет</h3></th>
                        <th><h3>Познака директиви</h3></th>
                        
                    </tr>


            </thead>
            <tbody>
                <?php
                    $db = new mysqli("localhost","root","root","work2");
                    $db->set_charset("utf8");
                    $sql = $db->query("SELECT * FROM katalog Limit 1000");
                    $_r = $sql->num_rows;
                    if ($_r > 0)
                    $sql = $db->query("SELECT * FROM katalog Limit 2000");
                    $_r = $sql->num_rows;
                    if ($_r > 0)
                    {
                        while ($tablerows = $sql->fetch_array())
                        {
                            echo '
                                <tr>
                                    <td>
                                        <a>'.$tablerows[0].'</a>
                                    </td>
                                    <td>
                                        <a>'.$tablerows[1].'</a>
                                    </td>
                                    <td>
                                        <a>'.$tablerows[5].'</a>
                                    </td>
                                    <td>
                                        <a>'.$tablerows[7].'</a>
                                    </td>
                                    <td>
                                        <a>'.$tablerows[16].'</a>
                                    </td>
                                     <td>
                                        <a>'.$tablerows[12].'</a>
                                    </td>
                                     <td>
                                        <a>'.$tablerows[20].'</a>
                                    </td>
                                     <td>
                                        <a>'.$tablerows[18].'</a>
                                    </td>
                                      <td>
                                        <a>'.$tablerows[21].'</a>
                                    </td>
                                     <td>
                                        <a>'.$tablerows[14].'</a>
                                    </td>
                                    <td>
                                        <a>'.$tablerows[15].'</a>
                                    </td>
                                     <td>
                                        <a>'.$tablerows[13].'</a>
                                    </td>
                                     <td>
                                        <a>'.$tablerows[4].'</a>
                                    </td>
                                </tr>
                            
                            
                            ';
                            
                            
                        }                       
                        
                    }else{
                        echo '<tr><td colspan=4 style="text-align: center;">Ничего нет</td></tr>';
                    }

                ?>

            </tbody>
        </table>

        <div id="tablefooter">
          <div id="tablenav">
                <div>
                    <img src="images/first.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1,true)" />
                    <img src="images/previous.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1)" />
                    <img src="images/next.gif" width="16" height="16" alt="First Page" onclick="sorter.move(1)" />
                    <img src="images/last.gif" width="16" height="16" alt="Last Page" onclick="sorter.move(1,true)" />
                </div>
                <div>
                    <select id="pagedropdown"></select>
                </div>
                <div>
                    <a href="javascript:sorter.showall()">view all</a>
                </div>
            </div>
            <div id="tablelocation">
                <div>
                    <select onchange="sorter.size(this.value)">
                    <option value="5">5</option>
                        <option value="10" selected="selected">10</option>
                        <option value="20">20</option>
                        <option value="50">50</option>
                        <option value="100">100</option>
                    </select>
                    <span>Entries Per Page</span>
                </div>
                <div class="page">Page <span id="currentpage"></span> of <span id="totalpages"></span></div>
            </div>
        </div>
    </div>

    <script type="text/javascript" src="script.js"></script>
    <script type="text/javascript">
    var sorter = new TINY.table.sorter('sorter','table',{
        headclass:'head',
        ascclass:'asc',
        descclass:'desc',
        evenclass:'evenrow',
        oddclass:'oddrow',
        evenselclass:'evenselected',
        oddselclass:'oddselected',
        paginate:true,
        size:10,
        colddid:'columns',
        currentid:'currentpage',
        totalid:'totalpages',
        startingrecid:'startrecord',
        endingrecid:'endrecord',
        totalrecid:'totalrecords',
        hoverid:'selectedrow',
        pageddid:'pagedropdown',
        navid:'tablenav',

        init:true
    });
  </script>
</body>
</html>

Ответы (0 шт):