Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class cms
- {
- private $mysqli;
- function __construct()
- {
- $this->mysqli = new mysqli("127.0.0.1", "cms", "testuser", "cms", 3306);
- if ($this->mysqli->connect_errno)
- {
- echo "Failed to connect to MySQL: (" . $this->mysqli->connect_errno . ") " . $this->mysqli->connect_error;
- }
- }
- function title($pagename)
- {
- $query = $this->mysqli->prepare("SELECT title FROM pages WHERE pagename=?");
- $query->bind_param("s", $pagetitle);
- $query->bind_result($title);
- $query->execute();
- $query->fetch();
- $query->close();
- echo $title;
- }
- function content($pagename)
- {
- $query = $this->mysqli->prepare("SELECT content FROM pages WHERE pagename=?");
- $query->bind_param("s", $pagetitle);
- $query->bind_result($content);
- $query->execute();
- $query->fetch();
- $query->close();
- echo $content;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement