Undefined index: unpaid

$unpaid1="SELECT t.id, t.year, t.property_id, COALESCE(t.amount,0) AS amount FROM tax_amount t WHERE t.status = 'unpaid' ORDER BY t.year";
$resultpropertyunpaid1 = $db->query($unpaid1);
while($row = $resultpropertyunpaid1->fetch_assoc()){ 
    $PropertyUnpaid1 = $row['unpaid'];
}

When I'm making a new property and put the amount the error will show but after I paid the total amount the error will not show.

how to upload multiple images using Longblob

if (count($_FILES) > 0) {

    if (is_uploaded_file($_FILES['userImage']['tmp_name'])) {

        $imgData = addslashes(file_get_contents($_FILES['userImage']['tmp_name']));
        $imageProperties = getimageSize($_FILES['userImage']['tmp_name']);

        $sql = "INSERT INTO trial (imageType ,imageData,uploaded_on, user_id,tax_payer_id)
                VALUES('{$imageProperties['mime']}', '{$imgData}',NOW(),'".$_SESSION['id']."','".$_GET['id']."')";
        $current_id =  mysqli_query($db, $sql) or die("<b>Error:</b> Problem on Image Insert<br/>" . mysqli_error($db));
        $current_id = mysqli_insert_id($db);

        if (isset($current_id)) {
           echo "Upload Succesfully";
        }else{
            echo "There is a problem";
        }
    }
}
?>  

    <form name="frmImage" enctype="multipart/form-data" action="" method="post"                         class="frmImageUpload">
        <label>Upload QrCode File:</label><br /> 
        <input type="file" class="inputFile" name="userImage" />
                <input type="hidden" name="imageID"  value="<?php if(!empty($_GET['id'])){ echo $_GET['id'];} ?>">
        <input type="submit" value="Submit" class="btnSubmit" />
    </form>

I'm trying to upload multiple images and I'm using longblob to store the images in database.

There is no Image to show after I upload image

<?php
if (count($_FILES) > 0) {
    if (is_uploaded_file($_FILES['userImage']['tmp_name'])) {

        $imgData = addslashes(file_get_contents($_FILES['userImage']['tmp_name']));
        $imageProperties = getimageSize($_FILES['userImage']['tmp_name']);

        $sql = "INSERT INTO qr(user_id,file_name ,QrCode)
                VALUES('".$_SESSION['id']."','{$imageProperties['mime']}', '{$imgData}')";
        $current_id = mysqli_query($db, $sql) or die("<b>Error:</b> Problem on Image Insert<br/>" . mysqli_error($db));
        if (isset($current_id)) {
            header("Location: preview.php");
        }
    }
}
?>
    <form name="frmImage" enctype="multipart/form-data" action=""
        method="post" class="frmImageUpload">
        <label>Upload QrCode File:</label><br /> <input name="userImage"
            type="file" class="inputFile" /> <input type="submit"
            value="Submit" class="btnSubmit" />
    </form>



<?php
require_once '../php_action/database.php';
    if(isset($_GET['image_id'])) {
        $sql = "SELECT file_name , QrCode FROM qr WHERE id=" . $_GET['image_id'] . mysqli_error(($db)). mysqli_error(($db));
        $result = mysqli_query($db, $sql) or die("<b>Error:</b> Problem on Retrieving Image BLOB<br/>" . mysqli_error($db));
        $row = mysqli_fetch_array($result);
        header("Content-type: " . $row["file_name"]);
        echo $row["QrCode"];
    }
    mysqli_close($db);
?>

Image wont display for my user

<?php
            if(isset($_SESSION['id']) ) {
            ($_SESSION['id']) {
                //echo "you're login";
            }
                echo "<form action='upload.php' enctype='multipart/form-data' method='post'>
                    <br>Qr Code:
                    <p><input type='file' name='file' >
                    <p><input type='submit' value='Upload' name='submit'>
                      </form>";
                            }
                ?>
 <?php
                $statusMsg = '';
                // File upload path
                $targetDir = "qr_code/";
                $fileName = basename($_FILES["file"]["name"]);
                $targetFilePath = $targetDir . $fileName;
                $fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION);
                if(isset($_POST["submit"]) && !empty($_FILES["file"]["name"])){
                    // Allow certain file formats
                    $allowTypes = array('jpg','png','jpeg','gif','JPG','PNG','GIF','JPEG');
                    if(in_array($fileType, $allowTypes)){
                        // Upload file to server
                        if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){
                            // Insert image file name into database
                            $insert = $db->query("INSERT into qr (user_id,file_name, uploaded_on) 
                                        VALUES ('".$_SESSION['id']."','".$fileName."', NOW())");
                            if($insert){
                                $statusMsg = "The file ".$fileName. " has been uploaded successfully.";
                                    header ("Location:employee.php?uploadsuccess");
                            }else{
                                $statusMsg = "File upload failed, please try again.";
                            }
                        }else{
                            $statusMsg = "Sorry, there was an error uploading your file.";
                        }
                    }else{
                        $statusMsg = 'Sorry, only JPG, JPEG, PNG, GIF files are allowed to upload.';
                    }
                }else{
                    $statusMsg = 'Please select a file to upload.';
                }
                // Display status message
                echo $statusMsg;
                ?>

<?php
                     $query = $db->query("SELECT * FROM qr where user_id='".$_SESSION['id']."' ORDER BY uploaded_on DESC limit 1 ");
                        if($query->num_rows > 0){
                            while($row = $query->fetch_assoc()){
                                $imageURL = 'qr_code/'.$row["file_name"];
                        ?>
                            <img src="<?php echo $imageURL; ?>" alt="" />
                        <?php }
                        }else{ ?>
                              <img src="images/qr.png" alt="" />

                    <?php } ?>