public function delete() { $stmt = Prioritet::getInstance()->prepare("DELETE FROM " . self::$table_name . " WHERE id = :id"); $stmt->bindParam(':id', $this->id, PDO::PARAM_INT); if ($stmt->execute()) { return true; } else { foreach (Prioritet::getInstance()->errorInfo() as $error) { echo $error . '<br />'; } return false; } }
<p>Tekst zadatka</p> <input type="textarea" name="tekst" value="<?php echo $zadatak->tekst; ?> "> <p>Datum kad zadatak istièe:</p> <input type="datetime" name="expire_at" value="<?php echo $zadatak->expire_at; ?> "> <p>Prioritet zadatka</p> <select name="prioritet_id"> <option value="">Odaberi Prioritet</option> </option> <?php $prioriteti = Prioritet::all(); ?> <?php foreach ($prioriteti as $prioritet) { ?> <option value=<?php echo $prioritet->id; if ($prioritet->id == $zadatak->prioritet_id) { echo " selected=\"selected\""; } ?> ><?php echo $prioritet->naziv; ?> </option> <?php