Like this?
<?php
// Create connection
$con=mysql_connect("localhost:3306","root","") or die( mysql_error());
if(!mysql_select_db("db1", $con));
$result=mysql_query("SELECT * FROM tblstudent where studentid='" . $txtstudentid . "'");
echo "<table border=1>
<tr>
<td colspan=3 align=center> Student Records </td>
</tr>
<tr>
<td> Student ID </td>
<td> Firstname </td>
<td> Lastname </td>
</td>
";
while($row=mysql_fetch_array($result))
{
$studnum=$row['studentid'];
$fname=$row['firstname'];
$lname=$row['lastname'];
echo "<tr>
<td> $studnum </td>
<td> $fname </td>
<td> $lname </td>
</tr>";
}
echo "</table>";
?>
Still Error