*/ include 'functions.php'; $db = new PDO('sqlite:zahabe.db'); if (isset($_GET['id'])) { $rows = getMVByID($db, $_GET['id']); } else { if (isset($_GET['cnt'])) { $rows = getMVByNumber($db, $_GET['cnt']); } else { if (isset($_GET['add'])) { /*Not implemented*/ print "To be implemented"; } else { if (isset($_GET['type'])) { if ($_GET['type'] == "daily") { $rows = getDailyMV($db); } else { if ($_GET['type'] == "stories") { $rows = getAllStories($db); } } } else { $stmt = $db->prepare("SELECT Text, ID, Story, (select count(*) from MinnsDu b where a.id >= b.id) as cnt\n FROM MinnsDu a LEFT JOIN Stories ON a.ID = Stories.MVID ORDER BY ID asc"); $stmt->execute(); $rows = $stmt->fetchAll(); } } } } if (empty($rows)) { echo json_encode(["error" => "404 not found"]);
<input type="text" name="Text" id="nyruta" placeholder="Ny" required> <button type="submit" id="nybutton">Lägg till</button> </div> </form> <form id="EditForm" action="" method="post" accept-charset="utf-8" autocomplete="off"> <input type="integer" name="newPos" id="newPos" placeholder="#" value=""> <input type="text" name="text" id="editRuta" value=""> </form> <div id="dagens"> <b>Dagens Zahabe:</b> <ol> <?php try { $row = getDailyMV($db); if (isset($row['Story'])) { print "<div class='storyicon'><a href='story.php?id=" . $row['ID'] . "'><img src='assets/read.png' alt='read full'></a></div>"; print "<a href='story.php?id=" . $row['ID'] . "'><li value='" . $row['cnt'] . "'><span>" . $row['Text'] . "</span></li></a>"; } else { print "<li value='" . $row['cnt'] . "'>" . $row['Text'] . "</li>"; } } catch (PDOException $e) { print 'Exception : ' . $e->getMessage(); } ?> </ol> </div> <div id="rows"> <ol reversed id="MVs">