<h5>¿Esta seguro que desea borrar este artículo?</h5>
          <form action="ejer04Gestesimal.php" method="post">
            <input type="hidden" name="codArt" value="<?php 
echo $codArt;
?>
">
            <button class="btn waves-effect waves-light green" type="submit" name="action" value="borrar">SI
              <i class="material-icons right">delete</i>
            </button>
            <a href="ejer04Gestesimal.php" class="btn waves-effect waves-light red">NO
              <i class="material-icons right">cancel</i>
            </a>
          </form>
          <br>
          <a href="ejer04Gestesimal.php" class="btn waves-effect waves-light blue">Volver
            <i class="material-icons left">arrow_back</i>
          </a>
        </div>
      </article>
      
    </section>  
  </body>
  
  <footer>
    <p class="center-align"> © Jesús Caballero Corpas ©</p>
  </footer>
  <?php 
$conexion->close();
?>
</html>
 function closeConnection()
 {
     if (self::$conn !== null) {
         self::$conn->close();
     }
 }
        $row = $stmt->fetch(PDO::FETCH_ASSOC);
        $daemonid = 0;
        if (isset($row['daemonid'])) {
            $daemonid = $row['daemonid'];
        } else {
            $stmt = $db->prepare('INSERT INTO daemon (uid, name, shortname) VALUES (:uid, :uid, :uid);');
            $stmt->bindValue(':uid', $_REQUEST["uid"][$i], PDO::PARAM_STR);
            $stmt->execute();
            $daemonid = $db->lastInsertId();
        }
        $stmt = $db->prepare("INSERT INTO value (daemonid, value, unixtime) VALUES (:daemonid, :value, strftime('%s', 'now', 'localtime'));");
        $stmt->bindValue(':daemonid', $daemonid, PDO::PARAM_INT);
        $stmt->bindValue(':value', (double) $_REQUEST["value"][$i], PDO::PARAM_STR);
        $stmt->execute();
    }
    $db->close();
    exit;
} else {
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == "adddaemon" && isset($_REQUEST['uid']) && isset($_REQUEST['name']) && isset($_REQUEST['shortname']) && isset($_REQUEST['unit'])) {
        $stmt = $db->prepare('INSERT INTO daemon (uid, name, shortname, unit) VALUES (:uid, :name, :shortname, :unit);');
        $stmt->bindValue(':name', $_REQUEST["name"], PDO::PARAM_STR);
        $stmt->bindValue(':shortname', $_REQUEST["shortname"], PDO::PARAM_STR);
        $stmt->bindValue(':unit', $_REQUEST["unit"], PDO::PARAM_STR);
        $stmt->bindValue(':uid', $_REQUEST["uid"], PDO::PARAM_STR);
        $stmt->execute();
        $daemonid = $db->lastInsertId();
        $msg = '		<div class="message">Sensor ' . $_REQUEST['shortname'] . " with name &quot;" . $_REQUEST['name'] . "&quot; and id &quot;" . $daemonid . "&quot; created.</div>\n";
    } else {
        if (isset($_REQUEST['action']) && $_REQUEST['action'] == "edit" && isset($_REQUEST['uid']) && isset($_REQUEST['name']) && isset($_REQUEST['shortname']) && isset($_REQUEST['unit']) && isset($_REQUEST['daemonid'])) {
            $stmt = $db->prepare('UPDATE daemon SET uid=:uid, name=:name, shortname=:shortname, unit=:unit WHERE daemonid=:daemonid;');
            $stmt->bindValue(':daemonid', $_REQUEST["daemonid"], PDO::PARAM_INT);
        // if no basic query, we select everything
        $sqlquery = "select distinct MORSEGRAPHFILEID from morsesets";
    }
    //echo "$sqlquery";
    $results = $file_db->query($sqlquery) or die('Query failed');
    // Construct the Table
    echo "<table border=\"1\">";
    $counter = 0;
    foreach ($results as $m) {
        if ($counter == 0) {
            echo "<tr>";
        }
        $MGfileindex = $m[MORSEGRAPHFILEID];
        echo "<td> <img src=\"graphs/MGCC{$MGfileindex}.png\" usemap=\"#MGCC{$MGfileindex}\" width=\"200\" > </td>";
        $counter = $counter + 1;
        if ($counter == 5) {
            echo "</tr>";
            $counter = 0;
        }
        // Introduce the "map" objects
        include "graphs/MGCC{$MGfileindex}-cmapx.html";
    }
    echo "</table>";
    $file_db->close();
} catch (PDOException $e) {
    echo $e->getMessage();
}
?>