Search
<?php
$servername = "localhost";
$username = "root";
$password = "";
$database = "ait";
// Create connection
$conn = new mysqli($servername, $username, $password, $database);
if ($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
// Search data
$sql = "SELECT * FROM student";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{
while($row = $result->fetch_assoc())
{
echo "Student_id: " . $row["Student_id"] . " - Student_Name: " . $row["Student_name"]
. " - Email: " . $row["Email"] . " - Fees: " . $row["Fees"] . "<br>";
}
}
else
{
echo "No records found!";
}
$conn->close();
?>
Output
Student_id: 1 - Student_Name: Ali - Email: ali@example.com - Fees: 25000