How to Select the Data of Student in PHP GUI Application
by TechVidvan Team
Program 1
<html>
<body>
<center>
<form method=post action="SelectStudent.php">
<table border=1>
<tr>
<th>Student Id</th>
<td><input type=text name=txtid></td>
</tr>
<tr>
<td></td>
<td><input type=submit value=Search name=btnSubmit></td>
</tr>
</table>
<pre>
<?php
if(isset($_POST['btnSubmit']))
{
$stid=$_POST['txtid'];
$mycon=mysqli_connect("localhost","root","","Library") or die("Connection not success");
//echo "Connection sucees<br>";
$sql="select * from studentdata where sid=".$stid;
$record=$mycon->query($sql);
if(mysqli_num_rows($record)>0)
{
?>
<table border=1>
<tr>
<th>Roll No</th><th>Name</th><th>Phy</th><th>Chem</th><th>Maths</th>
</tr>
<tr>
<?php
while($row=mysqli_fetch_assoc($record))
{
echo "<td>". $row['sid']."</td>";
echo "<td>". $row['sname']."</td>";
echo "<td>". $row['phy']."</td>";
echo "<td>". $row['chem']."</td>";
echo "<td>". $row['math']."</td>";
}
}
else
echo "<font color=red size=5>Record not found</font>";
}
?>
</tr>
</pre>
</center>
</body>
</html>
Tags: how to select the data of student in php gui applicationPHPphp gui applicationphp practicalphp programselect the data of student in php gui application
TechVidvan Team
TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.