Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FORUM {
- function __construct($DB_con)
- {
- $this->db = $DB_con;
- }
- public function getSubject() {
- try {
- $query = $this->db->prepare("SELECT * FROM posts");
- $query->execute();
- //retrieve the columns inside the table posts
- $forumrows = $query->fetchAll(PDO::FETCH_ASSOC);
- //Output each column Id with its Value
- foreach($forumrows as $forumrow) {
- foreach($forumrow as $key=>$value) {
- //echo the key and value.
- echo "{$key} = {$value}<br>";
- }
- }
- } catch(PDOException $e) {
- echo $e->getMessage();
- }
- }
- }
- $forum = new FORUM($DB_con);
- $forum->getSubject();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement