Php 当用户使用id搜索时,将在表中显示整行

Php 当用户使用id搜索时,将在表中显示整行,php,mysql,Php,Mysql,我有mysql数据库,我正在浏览器中成功显示数据。 现在我需要用id搜索并显示表中的整行。用户输入id号后,将在表中显示总计行。所以我需要搜索框在php与表格式。 此代码将数据显示到浏览器中。我需要这个代码的搜索选项 <?PHP $connection=Mysql_connect('xxx','xxx','xxx'); if(!$connection) { echo 'connection is invalid'; } else

我有mysql数据库,我正在浏览器中成功显示数据。 现在我需要用id搜索并显示表中的整行。用户输入id号后,将在表中显示总计行。所以我需要搜索框在php与表格式。 此代码将数据显示到浏览器中。我需要这个代码的搜索选项

<?PHP
    $connection=Mysql_connect('xxx','xxx','xxx');
    if(!$connection)
    {
        echo 'connection is invalid';
    }
    else
    {
        Mysql_select_db('xxx',$connection);

    }
//check if the starting row variable was passed in the URL or not
if (!isset($_GET['startrow']) or !is_numeric($_GET['startrow'])) {
  //we give the value of the starting row to 0 because nothing was found in URL
$startrow = 0;
//otherwise we take the value from the URL
} else {
 $startrow = (int)$_GET['startrow'];
}
//this part goes after the checking of the $_GET var
$fetch = mysql_query("SELECT * FROM xxx ORDER BY id DESC LIMIT         $startrow,     10")or
die(mysql_error());
   $num=Mysql_num_rows($fetch);
    if($num>0)
    {
    echo "<table margin=auto width=999px border=1>";
    echo "<tr><td><b>ID</b></td><td><b>Name</b></td><td><b>Telephone</b></td><td><b>E-mail</b></td><td><b>Couttry Applying for</b></td><td><b>Visa-Category</b></td><td><b>Other Category</b></td><td><b>Passport No</b></td><td><b>Remarks</b></td></tr>";
    for($i=0;$i<$num;$i++)
    {
    $row=mysql_fetch_row($fetch);
    echo "<tr>";
    echo"<td>$row[0]</td>";
    echo"<td>$row[1]</td>";
    echo"<td>$row[2]</td>";
    echo"<td>$row[3]</td>";
    echo"<td>$row[4]</td>";
    echo"<td>$row[5]</td>";
    echo"<td>$row[6]</td>";
    echo"<td>$row[7]</td>";
    echo"<td>$row[8]</td>";
    echo"</tr>";
    }//for
    echo"</table>";
    }
//now this is the link..
echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+10).'"><img align=left     height=50px width=50px src="next.png"/></a>';

$prev = $startrow - 10;

//only print a "Previous" link if a "Next" was clicked
if ($prev >= 0)
    echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.$prev.'"><img align=right     height=50px width=50px src="previous.png"/></a>';
?>

现在我需要搜索按钮。当用户使用id搜索时,将以表格格式显示整行。
谢谢。

您可以尝试使用
Jquery
在表中搜索

请参考下面的链接,希望这是你所需要的


我没有使用表,我使用的是数据库,所以从数据库表中搜索数据