When trying to get data from database the stmt fails. Using similar type code in same file to GET data out of an other database and it works fine. Does it have anything to do with the fact that the 'thread-cat' is a foreign key in the database?
<?php
$catname = $_GET['cat'];
$sql = "SELECT * FROM `threads` WHERE thread-cat=?;";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)){
echo "SQL stmt failed";
} else {
mysqli_stmt_bind_param($stmt, "s", $catname);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
while($row = mysqli_fetch_assoc($result)){
$id = $row['thread-id'];
$title = $row['thread-title'];
$content = $row['thread-content'];
$timestamp = $row['timestamp'];
echo '<tr>
<td class="tg-0pky"><img src="https://via.placeholder.com/32x32"></td>
<td class="tg-0pky"><b><a href="">'.$title.'</a></b><br>by <a href="">(User)</a> - (Date created)</td>
<td class="tg-0pky">(Reply count)</td>
<td class="tg-0pky">by <a href="">(User)</a><br>(Date Last Post)</td>
</tr>';
}
}
?>