Site icon Hip-Hop Website Design and Development

have_posts() return false on single post

I’m a little bit confused with the use of the Loop. This is my first theme and i just use index.php currently to display all my pages. It works fine for pages but have_posts return false when i try to display a single post. Here is the code of the index.php:

<?php
get_header();
?>
<div class="left">
    <?php 
    if ( have_posts() ) :
        // Start the loop.
        while ( have_posts() ) : the_post();
            //echo for debugging
            echo 'index<br>';
            echo get_the_ID().'<br>';
            //function to display page
            field_page_builder_front_display(get_the_ID(),get_post_type(get_the_ID()));
        endwhile;
    else :
        ?> 
        Sorry, this page does not exist
        <?php
    endif;
    ?>
</div>
<?php
//display custom sidebar
get_side_bar();
get_footer();
?>

This index.php return “Sorry, this does not exist” for all my single post (articles or custom post). I thought it was because the loop is only for displaying multiple posts but the file single.php of the theme twentfifteen use the loop too, so i don’t understand the problem.

Thank in advance for all your help !