Desope 0 Newbie Poster

Hello.
I am having a problem here.
So I have this slider which display the pictures with status "1" which means displayed. Here comes the problem, when there's no pictures with the status AKA "0" (not-displayed), the default image doesn't show up. Here's the script.

<div class="carousel-inner">
    <?php
        $no=1;
        $default=$this->db->get_where("penyaluran", array("status" => "1"))->result();
        $g='image.jpg';
        $n='';
        foreach($default as $pict)
            {
                if ($g=$pict->foto_dokumentasi)
                    {
                        $n=$pict->nama_penyaluran;
                    } else
                    {
                        $g='image.jpg';
                        $n= '';
                    }
                if ($no == 1)
                    {
                        $status = 'active';
                    } else
                    {
                        $status = '';
                    }

    ?>
    <div class="carousel-item <?php echo $status; ?>">
        <img src="<?php echo base_url('uploads/'.$g); ?>" alt="" style="max-height: 300px; width: 1200px; margin-left: auto; margin-right: auto;">
        <div class="carousel-caption">
            <h3><?php echo $n; ?></h3> 
        </div>
    </div>
    <?php
            $no++;
        }
    ?>

Did I miss something here?