<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
include_once ($_SERVER['DOCUMENT_ROOT'] . '/_config/functions.php');
spl_autoload_register('my_autoload');
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . '/Auth/chk.auth.php');
$db                                     = new Database();

function setUuid($id)
{
  $uuid                                 = createUUID();
  $updateArray                          = array(
      'uuid'                            => $uuid,
  );
  $whereCause                           = 'id = :id';
  $whereVal                             = $id;
  pdoDbUpdate("tbl_daily_report", $updateArray, $whereCause, $whereVal);
}

$sql                                    = 'SELECT * FROM tbl_daily_report ORDER BY id';
$db->query($sql);
$db->bind(':uuid', "");
$rows                                   = $db->resultset();
foreach ($rows as $row) {
  setUuid($row['id']);
}
