Why isn’t this update script working?

I don't understand why this update script isn't working. It is supposed to get the names of files in the download folder and update the files table in the database. It is running through the code without exiting when it fails to update but still displays "Update Successful". The downloads folder is under the public_html folder where this script runs from.

<?PHP require_once("up_header.php"); ?>
</head>
 <body>

  <div class="container"> 
      <div class="row" style="text-align:center;" >
        <h1>Foxclone Filelist Updating</h1>
      </div>
      <div class="header">
  </div>   

<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$php_scripts = '../php/';
include $php_scripts . 'PDO_Connection_Select.php';

if (!$pdo = PDOConnect("foxclone_data"))
{   
    $chk=0;
    echo "Datbase Connection Failed";
    exit;
}

function convert_filesize($bytes, $decimals = 2){
  $size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
  $factor = floor((strlen($bytes) - 1) / 3);
  return sprintf("%.{$decimals}f", $bytes / pow(1000, $factor)) . @$size[$factor];

  $chk=0;
      $isos = glob('download/foxclone_std*');
      $iso = $isos[count($isos) -1];
      $isoname =  basename($iso);
      $md5file = md5_file($iso);
      $size = filesize($iso);            /*  yields filesize in bytes    */
      $isosize = convert_filesize($size);

      $edges = glob('download/foxclone_edge*.iso');
      $edge = $edges[count($edges) -1];
      $edgename =  basename($edge);
      $md5edge = md5_file($edge);
      $size = filesize($edge);
      $edgesize = convert_filesize($size);

       $pdfs = glob('download/foxcloneV*.pdf');
       $pdf = $pdfs[count($pdfs) -1]; 
       $pdfname = basename($pdf);

       $debs = glob('download/*.deb');
       $deb = $debs[count($debs) - 1];
       $debname =  basename($deb);
       $debmd5 = md5_file($deb);                   
       $size = filesize($deb);
       $debsize = convert_filesize($size);

       $srcs = glob('download/*.tar.gz');
       $src = $srcs[count($srcs) - 1];
       $srcname = basename($src);  
       $srcmd5 = md5_file($src);  
       $size = filesize($src);
       $srcsize = convert_filesize($size);

       $issuess = glob('download/news.pdf');
       $issue = $issuess[count($issuess) -1]; 
       $issname = basename($issue);
}


  if( isset( $isoname ) ) { 

        $stmt = $pdo->prepare("UPDATE `files` SET `filename` = ?, `md5` = ?, `filesize` = ?,`logtime` = now() WHERE `id` = ?");
        $stmt-> execute($isoname, $md5file, $isosize, 1) ;
        $stmt->execute();
        $count = $stmt->rowCount();
           if($count == 1){
              $cnt = 1;
               }
           else{
              echo('Update Failed');
              exit;
               }
        $stmt = $pdo->prepare("UPDATE `files` SET `filename` = ?, `md5` = ?, `filesize` = ?,`logtime` = now() WHERE `id` = ?");
        $stmt-> execute([$edgename, $md5edge, $edgesize, 6]) ;
        if($count == 1){
          $cnt = 1;
           }
        else{
          echo('Update Failed');
          exit;
           }        

        $stmt = $pdo->prepare("UPDATE `files` SET `filename` = ?, `logtime`=now() WHERE `id` = ?");
        $stmt-> execute([$pdfname, 2]) ;  
        if($count == 1){
          $cnt = 1;
           }
       else{
          echo('Update Failed');
          exit;
           }        

        $stmt = $pdo->prepare("UPDATE `files` SET `filename` = ?, `md5` = ?, `filesize` = ?, `logtime` = now() WHERE `id` = ?");
        $stmt->execute([$debname, $debmd5,$debsize, 3]) ;   
        if($count == 1){
          $cnt = 1;
           }
       else{
          echo('Update Failed');
          exit;
           }

        $stmt = $pdo->prepare("UPDATE `files` SET `filename` = ?, `md5` = ?,`filesize` = ?,`logtime` = now() WHERE `id` = ?");
        $stmt->execute([$srcname, $srcmd5, $srcsize,4]) ; 
          if($count == 1){
              $cnt = 1;
               }
           else{
              echo('Update Failed');
              exit;
               }
         $stmt = $pdo->prepare("UPDATE `files` SET `filename` = ?, `logtime`=now() WHERE `id` = ?");
         $stmt-> execute([$issname, 5]) ; 
          if($count == 1){
             $cnt = 1;
             }
          else{
            echo('Update Failed');
            exit;
              }

  }

    if($chk=0)
      echo "Database Update Failed";
    else
      echo "Database Update Successful" ;

Appreciate your help.