Beispiel #1
0
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$num_res = count($result);
$PageDisplay = 0;
if (isset($_GET["page"])) {
    $PageDisplay = $_GET["page"];
}
$numPerPage = 30;
$max_page = (int) ($num_res / $numPerPage);
if ($PageDisplay > $max_page) {
    $PageDisplay = $max_page;
} else {
    if ($PageDisplay < 0) {
        $PageDisplay = 0;
    }
}
Print_Post($result, $adminEamil, $PageDisplay);
if ($max_page > 0) {
    echo '<ul class="pagination">';
    for ($i = 0; $i <= $max_page; $i++) {
        if ($i == $PageDisplay) {
            echo '<li class = "active">';
        } else {
            echo '<li>';
        }
        echo '<a href="admin.php?page=' . $i . '">' . ($i * $numPerPage + 1) . '-' . ($i + 1) * $numPerPage . '</a>';
    }
    echo '</ul>';
}
?>
          </form>
      </div>
Beispiel #2
0
function Display_all_query()
{
    $conn = getconn();
    $stmt = $conn->prepare("select * from post_info order by time DESC;");
    $result = $stmt->execute();
    if (!$result) {
        echo "What the f**k?";
        pdo_die($stmt);
    }
    $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
    Print_Post($result);
}