0

I'm trying to connect to my database to show a row of data from mySQL. I believe I have my data connection set up correctly, as I am able to post data into my database. So I don't believe the error lies in my connection variable $conn. So I am a bit confused in what I could do to try to debug this situation. Any help would be amazing! Thank you!!

Below is my code to retrieve my data from my database:

$sql = "SELECT * FROM `scream` ORDER BY `id` DESC LIMIT 0,1;";

$result = mysqli_query($conn, $sql);

$resultCheck = mysqli_num_rows($result);
    
if ($resultCheck > 0) {
    while ($row = mysqli_fetch_assoc($result)) {
        echo $row['volt'];
    }
}
else{
    echo "no data";
}

0 Answers0