I am trying to fetch the data from Mysql database and print it on new web page. I need to display the output in table format.
below is the PHP script, help me out to do so.
Thanks in advance.
<?php
$userinput = $_POST['Sample_name'];
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "ProcessTrackingSystem";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_errno) {
printf("Connect failed: %s
", $conn->connect_error);
exit();
}
$result = mysqli_query($conn, "SELECT * FROM ProcessTrackingSystem.ProcessDetails
WHERE Sample_name = '$userinput'") or die(mysqli_error($conn));
while ($row=mysqli_fetch_assoc($result))
{
printf("Sample_name:->");
printf($row['Sample_name']);
printf("<br>
");
printf("<br>
");
printf("SO_ID:->");
printf($row['SO_ID']);
printf("<br>
");
printf("<br>
");
}
mysqli_free_result($result);
$conn->close();
?>
I need output in tabular format.