如何在php中使用while获取数据库中的图像

I'm trying to fetch the image from my database using while loop in php but there's an error. can anyone help me? sorry for my bad english.

<div class="gallery" id="links">

                <?php
                     $query = $dbconn->query("select * from `uploading`") or die(mysqli_error());
                     while($fetch = $query->fetch_array()){
                                       ?>

                    <a class="gallery-item" href="artifactimage/<?php echo $fetch['artifact_image']; ?>" title="<?php echo $title ?>" data-gallery>
                        <div class="image">
                            <img src="artifactimage/<?php echo $fetch['artifact_image']; ?>" width="400" height="150" alt="<?php echo $fetch['artifact_name']; ?>" />
                            <ul class="gallery-item-controls">
                                <li><label class="check"><input type="checkbox" class="icheckbox" /></label></li>
                                <li><span class="gallery-item-remove"><i class="fa fa-times"></i></span></li>
                            </ul>
                        </div>
                        <div class="meta">
                            <strong>
                                <?php echo $fetch['artifact_name']; ?></strong>
                            <span>
                                <?php echo $fetch['artifact_desc']; ?></span>
                        </div>
                    </a>

                    <div id="preview"><img src="filed.png" /></div><br>

                <?php
    }

    ?>
</div>

The error:


Notice: Undefined variable: title in C:\xampp\htdocs\HAHMIS\artifactlist.php on line 9