After Inserting data into database you want to display the data that are in database.for that run the below query in php file and display data.
<?php
include('config.php');
$sql = "SELECT id, firstname, lastname FROM Your_table_name";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{
// output data of each row
while($row = $result->fetch_array())
{
echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
}
}
else
{
echo "0 results";
}
?>
If the data is present in table then the data will be display otherwise "0 results" found error message will be displayed.
Note: Don't forget to add connection string into your file.
<?php
include('config.php');
$sql = "SELECT id, firstname, lastname FROM Your_table_name";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{
// output data of each row
while($row = $result->fetch_array())
{
echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
}
}
else
{
echo "0 results";
}
?>
If the data is present in table then the data will be display otherwise "0 results" found error message will be displayed.
Note: Don't forget to add connection string into your file.
0 Comments