Database:
Database:
Date:
Time:
oreiph_webshop
Connecting to database
and retreiving data:
connect_error) {
die("Connection failed: " . $conn->connect_error);
}
else
{
echo "DATABASE CONNECTED!";
echo " ";
echo " ";
echo "Retreived from ". $dbname;
echo ":";
echo "
";
echo "
";
$sql = "SELECT ID, Category ,Product ,Price, Description FROM products ";
$result=mysqli_query($conn,$sql);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
echo "id: " . $row["ID"]. " - Name: " . $row["Category"]. " Price " . $row["Price"]. " Product " . $row["Product"]. " Description " . $row["Description"]. "
";
}
}
else
{
echo "0 results";
}
mysqli_free_result($result);
mysqli_close($conn);
echo "
";
echo "Database closed successfully
";
echo "\n\r\f";
echo "
";
echo "
";
echo "
";
echo "Awaiting new data!
";
printf ("%s \n",$row["ID"],$row["Category"],$row["Price"],$row["Product"],$row["Description"]);
}
?>