Showing single record by link in PHP, MYSQL

555786
06:12:16
[*][list=]Hi friends...!
I am new in PHP MYSQL. I am doing a project where I have to make table of students and if user click on any student so more detail of that particular student must be shown on next window.

<?php
$dbhost='localhost';
$dbuser='root';
$dbpass='';
$dbname = 'reg.form';

// Create connection
$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT admission_no, first_name,last_name FROM r_form";

$result = $conn->query($sql);

if ($result->num_rows > 0) {
echo "<table border='1'><tr><th>Admission No:</th><th>Student Name</th><th>Show Details</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["admission_no"]. "</td><td>" . $row["first_name"]." ".$row["last_name"].
"</td><td><a href='fettchreg1.php'>Show Record</a>". "</td></tr> " ;
}
echo "</table>";
} else {
echo "0 results";
}


?>
[/list]
Please Login to post your reply or start a new topic