so I'm making a website and one of my pages needs me to use php which I am very new to, I used XAMPP to make the page and it was working but once I uploaded it, the page stopped working since mysqli_query() keeps returning false.
Yes, I checked my connection to my database and I also tested my mysql queries on phpmyadmin and they work completely fine.
<div class="dbOUTPUT">
<ul>
<?php
$sql = "SELECT * FROM `moon`;";
$result = mysqli_query($conn, $sql);
if($result){
if(mysqli_num_rows($result) > 0){
$i = 1;
while($rows = mysqli_fetch_assoc($result)){
echo "<li><form action='DBConnection/deleteIntoMoon.php' method=POST>";
echo "<div class='listItem'>{$rows['locations']}";
echo "<button type='submit' name='submit' value='{$i}'>X</button>";
echo "</div></form></li>";
$i++;
}
}else{echo 'error in mysql';}
}
?>
</ul>
</div>
This code results in the following: "error in mysql" from the else statement.
I know this isn't the most efficient code but any help would be appreciated:)