Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. include_once 'database.php';
  4.  
  5. class FORUM {
  6.  
  7. private $rows;
  8.  
  9. function __construct($DB_con)
  10. {
  11. $this->db = $DB_con;
  12. $this->rows = $rows;
  13. }
  14.  
  15. public function getColumn() {
  16. try {
  17. $query = $this->db->prepare("DESCRIBE threads");
  18. $query->execute();
  19. //retrieve the columns inside the table posts
  20. $this->rows = $query->fetchAll(PDO::FETCH_COLUMN);
  21. } catch(PDOException $e) {
  22. echo $e->getMessage();
  23. }
  24. }
  25.  
  26. public function setColumn() {
  27. //output the column values
  28. foreach($this->rows as $row) {
  29. echo $row . "</br>";
  30. }
  31. }
  32.  
  33. } //End forum class
  34.  
  35. $forum = new FORUM($DB_con);
  36. $forum->setColumn();
  37.  
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement