How to Store Old pic in Database if no new image Updated In php

hi in my form when user submit the form and select no image then my database updated blank can you help me where is wrong in the code I don’t have PHP knowledge so need your help

here is my Full PHP code hope you got it where is this wrong

i want if user not select image then old image does not replace with blank

i try in my code my still got blank!

<?php
include("connect.php");
    if(isset($_POST['submit']))
    {
        $id = $_POST['id'];
        $form_no = $_POST['form_no'];
        $shop_name = $_POST['shop_name'];
        $shop_address = $_POST['shop_address'];
        $owner_name = $_POST['owner_name'];
        $owner_address = $_POST['owner_address'];
        $phone = $_POST['phone'];
        $m_no = $_POST['m_no'];
        $email = $_POST['email'];
        $d_o_b = $_POST['d_o_b'];
        $d_o_m = $_POST['d_o_m'];
        $b_type = $_POST['b_type'];
        $reg_no = $_POST['reg_no'];
        $coment = $_POST['coment'];
        $date = date('y-m-d');
        $errors = "";
        $plan = $_POST['select'];
        $oldpic=$_POST["oldpic"];
        if($_FILES['image']['name'] != "" && $errors == "")
        {
            $file_name = $_FILES['image']['name'];
            $file_size = $_FILES['image']['size'];
            $file_tmp = $_FILES['image']['tmp_name'];
            $file_type = $_FILES['image']['type'];
            $file_ext=strtolower(end(explode('.',$file_name)));
            $expensions= array("jpeg","jpg","png");
            if(!in_array($file_ext,$expensions))
            {
                $errors="extension not allowed, please choose a JPEG or PNG file.";
            }

            if($file_size > 2097152)
            {
                $errors ='File size must be excately 2 MB';
            }
            if(empty($errors))
            {
                $new_file_name = uniqid().'.'.$file_ext;
                move_uploaded_file($file_tmp,"user/".$new_file_name);
            }
        }

        if(empty($errors))
        {
            $qreury = "UPDATE members SET 
            ref_no='$ref_no',shop_name='$shop_name', form_no='$form_no',
            shop_address='$shop_address', owner_name='$owner_name',
            owner_address='$owner_address', tel_no='$phone', mobile_no='$m_no',
            email='$email',dob='$d_o_b',marrige_date='$d_o_m',bussiness_type='$b_type',
            reg_no='$reg_no',extra_note='$coment',user_pic='$new_file_name',
            plan='$plan',target=(select price from members_plan where id ='$plan') WHERE id='$id'";
            $reslt = mysql_query($qreury)or die(mysql_error());
            header("location:registered_members.php");

        }
    elseif(empty($oldpic))
        {
            $qreury = "UPDATE members SET 
            ref_no='$ref_no',shop_name='$shop_name', form_no='$form_no',
            shop_address='$shop_address', owner_name='$owner_name',
            owner_address='$owner_address', tel_no='$phone', mobile_no='$m_no',
            email='$email',dob='$d_o_b',marrige_date='$d_o_m',bussiness_type='$b_type',
            reg_no='$reg_no',extra_note='$coment',user_pic='$oldpic',
            plan='$plan',target=(select price from members_plan where id ='$plan') WHERE id='$id'";
            $reslt = mysql_query($qreury)or die(mysql_error());
            header("location:registered_members.php");
        }
    }
?>
     {
if(empty($_FILES))   {
$error="Please select a photo to continue";
break;
}
    $reg_no = $_POST['reg_no'];
        $coment = $_POST['coment'];
        $date = date('y-m-d');
        $errors = "";
        $plan = $_POST['select'];
        $oldpic=$_POST["oldpic"];
        if($_FILES['image']['name'] != "" && $errors == "")
        {
            $file_name = $_FILES['image']['name'];
            $file_size = $_FILES['image']['size'];
            $file_tmp = $_FILES['image']['tmp_name'];
            $file_type = $_FILES['image']['type'];
            $file_ext=strtolower(end(explode('.',$file_name)));
            $expensions= array("jpeg","jpg","png");
            if(!in_array($file_ext,$expensions))
            {
                $errors="extension not allowed, please choose a JPEG or PNG file.";
            }

            if($file_size > 2097152)
            {
                $errors ='File size must be excately 2 MB';
            }
            if(empty($errors))
            {
                $new_file_name = uniqid().'.'.$file_ext;
                move_uploaded_file($file_tmp,"user/".$new_file_name);
            }
        }

        if(empty($errors))
        {
            $qreury = "UPDATE members SET 
            ref_no='$ref_no',shop_name='$shop_name', form_no='$form_no',
            shop_address='$shop_address', owner_name='$owner_name',
            owner_address='$owner_address', tel_no='$phone', mobile_no='$m_no',
            email='$email',dob='$d_o_b',marrige_date='$d_o_m',bussiness_type='$b_type',
            reg_no='$reg_no',extra_note='$coment',user_pic='$new_file_name',
            plan='$plan',target=(select price from members_plan where id ='$plan') WHERE id='$id'";
            $reslt = mysql_query($qreury)or die(mysql_error());
            header("location:registered_members.php");

            }
        elseif(empty($oldpic))
            {
                $qreury = "UPDATE members SET 
                ref_no='$ref_no',shop_name='$shop_name', form_no='$form_no',
                shop_address='$shop_address', owner_name='$owner_name',
                owner_address='$owner_address', tel_no='$phone', mobile_no='$m_no',
                email='$email',dob='$d_o_b',marrige_date='$d_o_m',bussiness_type='$b_type',
                reg_no='$reg_no',extra_note='$coment',user_pic='$oldpic',
                plan='$plan',target=(select price from members_plan where id ='$plan') WHERE id='$id'";
                $reslt = mysql_query($qreury)or die(mysql_error());
                header("location:registered_members.php");
            }
        }

        }while(0);

Replace your code with mine it will work

I understand your problem, Please let Your code do what its doing. Even if you are storing null then don’t worry. Store the null and put an avtar default image on your file system, and then You can do the following while fetching the image to view it for you:

    <img src="
<?php !empty($your-image-with-directory)?$your-image-with-directory:"upload-directory/avtar.png"?>" width="100">