<?php
class twits extends db {
function load($id="",$lx=-1,$ly=-1) {
if(!self::$dbh) $this->connect();
if(strlen($id)) {
$id = self::$dbh->quote($id);
$where = "WHERE id=$id";
} else $where = "status > -1";
if($lx!=-1) {
$limit = "LIMIT $lx,$ly";
} else $limit="";
try {
$result = self::$dbh->query("SELECT * from twits $where order by ctime desc $limit");
$rows = $result->fetchall(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
$this->fatal_error($e->getMessage());
}
if(strlen($id) && count($rows)) return $rows[0];
return $rows;
}
}
?>