I create a binary tree. I have a first question and when I click on 'yes', I want to see a second question which is left etc. But here, I see directly the last item.
When I click, I want to display a next item of my db like this:
for( $i = 0; $i < $count; $i++ ) {
if(isset($_POST['yes'])){
$select = $db->prepare('SELECT * FROM node where id=:id');
$select->bindParam(':id', $current_id_left);
$select->execute();
$nodes = $select->fetch();
$current_id_left = $nodes->id_left_node_children;
$current_id_right = $nodes->id_right_node_children;
$current_question = $nodes->questions;
}
It works but the loop gives me the last item. Before the last item, I have a second item which is not displayed.
How can I display items one by one?