Thank you for changing the password - I won’t do that again! The 500 error only appears, however, because you changed the password and when you update it in the book_fetcher.php code and then run the php file I get no errors. Unfortunately, there is also no json output either, which I think I want. The following code works, albeit with the new password, which makes me think the php is OK:
<?php
$servername = "sql305.infinityfree.com";
$username = "if0_35349896";
$password = "OYHF6DQIyE5l8";
$dbname = "if0_35349896_books";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// SQL query to fetch data
$sql = "SELECT * FROM `TABLE 1`";
$result = $conn->query($sql);
// Fetch data and generate HTML table
if ($result->num_rows > 0) {
echo "<table border='1'>
<tr>
<th>Id</th>
<th>Item Name</th>
<th>Item Author</th>
<th>Image URL</th>
</tr>";
// Output data of each row
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['item_name'] . "</td>";
echo "<td>" . $row['item_author'] . "</td>";
echo "<td>" . $row['image_url'] . "</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "0 results";
}
// Close the connection
$conn->close();
?>