host = $host;
$this->username = $username;
$this->password = $password;
$this->table = $db;
$this->connect();
}
/**
deletes all the comments in the blog database for the suppled id
*/
public function delete_thread($id){
$q = "DELETE FROM blog WHERE id = '$report'";
return mysql_query($q);
}
/**
Display all comment entrys for the specified report
*/
public function get_blog() {
/* Instantiate class */
require_once("pager.php");
$p = new Pager;
/* Show many results per page? */
$limit = 5;
/* Find the start depending on $_GET['page'] (declared if it's null) */
$start = $p->findStart($limit);
/* Find the number of rows returned from a query; Note: Do NOT use a LIMIT clause in this query */
$count = mysql_num_rows(mysql_query("SELECT * FROM blog"));
/* Find the number of pages based on $count and $limit */
$pages = $p->findPages($count, $limit);
/* Now we use the LIMIT clause to grab a range of rows */
$r = mysql_query("SELECT * FROM blog ORDER BY id DESC LIMIT ".$start.", ".$limit);
/* Now get the page list and echo it */
$pagelist = $p->pageList($_GET['page'], $pages);
if ( $r !== false && mysql_num_rows($r) > 0 ) {
while ( $a = mysql_fetch_assoc($r) ) {
$title = stripslashes($a['title']);
$bodytext = stripslashes($a['bodytext']);
$username = $a['name'];
$gravatar = 'http://www.gravatar.com/avatar/' . $a['email'] . '?s=48';
$date = $a['created'];
$entry_display .= << $bodytext
$username : $title
Posted: $date