Answer the question
In order to leave comments, you need to log in
Why is it impossible to extract rows from the database?
Hello colleagues! I recently ran into the following problem:
I don't know what's wrong, but the bottom line is that if you enter the query "SELECT title FROM tours" through PhpMyAdmin, then everything works as it should.
But for some reason, through PHP, I can't do the same:
<?php
include("modules/php/database.php");
$db = db_connect();
$query = "SELECT title FROM tours";
$stmt = $db->prepare($query);
$stmt->bind_result($title);
while($stmt->fetch()){
echo $title;
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question