Advertisement
Guest User

Untitled

a guest
Sep 24th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <?php
  2.  
  3.     class DatabaseFunctions {
  4.     public $host = "localhost";
  5.     public $user = "root";
  6.     public $pass = "";
  7.     public $db = "cms";
  8.     public $mysqli;
  9.  
  10.     public function pull_latest_post() {
  11.         $this->$mysqli = new mysqli($this->host,$this->user,$this->pass,$this->db);
  12.  
  13.         $sql_latest = mysqli_query($this->mysqli,"SELECT * FROM content") or die("Failed to retrive latest posts!" . mysql_error($this->mysqli));
  14.         while($result_latest = mysqli_fetch_array) {
  15.             echo $result_latest['title'];
  16.             echo "<br />";
  17.             echo $result_latest['body'];
  18.             echo "<br />";
  19.             echo $result_latest['date'];
  20.             }
  21.             // End of while loop for pull_latest_post
  22.         }
  23.         // End of pull_latest_post
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. }
  31. // End of class
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement