fix of administration listing
This commit is contained in:
@@ -44,13 +44,12 @@ class Post {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->fetchAll();
|
$result = $stmt->fetchAll();
|
||||||
|
|
||||||
$stmtTotal = $this->conn->prepare("SELECT COUNT(*) as count; FROM ".$this->postTable);
|
$stmtTotal = $this->conn->prepare("SELECT COUNT(*) as count FROM ".$this->postTable);
|
||||||
$stmtTotal->execute();
|
$stmtTotal->execute();
|
||||||
$allResult = $stmtTotal->fetch(PDO::FETCH_ASSOC);
|
$allResult = $stmtTotal->fetch(PDO::FETCH_ASSOC);
|
||||||
$allRecords = $allResult['count'];
|
$allRecords = $allResult['count'] * 1;
|
||||||
|
|
||||||
|
|
||||||
$displayRecords = count($result);
|
|
||||||
$posts = array();
|
$posts = array();
|
||||||
foreach ($result as $post) {
|
foreach ($result as $post) {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
@@ -76,7 +75,7 @@ class Post {
|
|||||||
|
|
||||||
$output = array(
|
$output = array(
|
||||||
"draw" => intval($_POST["draw"]),
|
"draw" => intval($_POST["draw"]),
|
||||||
"iTotalRecords" => $displayRecords,
|
"iTotalRecords" => count($posts),
|
||||||
"iTotalDisplayRecords" => $allRecords,
|
"iTotalDisplayRecords" => $allRecords,
|
||||||
"data" => $posts
|
"data" => $posts
|
||||||
);
|
);
|
||||||
@@ -123,12 +122,21 @@ class Post {
|
|||||||
$stmt->bindParam("s", $this->status);
|
$stmt->bindParam("s", $this->status);
|
||||||
$stmt->bindParam("u", $this->updated);
|
$stmt->bindParam("u", $this->updated);
|
||||||
$stmt->bindParam("cr", $this->created);
|
$stmt->bindParam("cr", $this->created);
|
||||||
|
<?php
|
||||||
if($stmt->execute()){
|
if (session_id() == "") session_start();
|
||||||
return $this->conn->lastInsertId();
|
class Post {
|
||||||
}
|
|
||||||
}
|
private $postTable = 'articles';
|
||||||
}
|
private $categoryTable = 'categories';
|
||||||
|
private $userTable = 'users';
|
||||||
|
private $conn;
|
||||||
|
|
||||||
|
public function __construct($db){
|
||||||
|
… $result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
return $result['count'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
public function update(){
|
public function update(){
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user