I'm a beginner and I'm trying to view my database. Please help me solve it.
This is the error shown:
Parse error: syntax error, unexpected 'Date' (T_STRING), expecting ',' or ';' in C:\xampp\htdocs\SLR\ViewData.php on line 20
This is my code:
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "slr";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT soft_id, soft_name, installed_date, expiry_date, product_key FROM software";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "Software ID: " . $row["soft_id"]. " - Software Name: " . $row["soft_name"]. - Installed Date: " . $row["installed_date"].- Expiry Date: " . $row["Expiry Date"].- Product Key: " . $row["product_key"]."<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>