public static function find_all_by_entry_id($entry_id) { $result = pg_query("select * from comments where entry_id = '" . pesc($entry_id) . "' order by posted_at desc"); $entries = array(); while ($row = pg_fetch_assoc($result)) { array_push($entries, self::from_row($row)); } return $entries; }
public static function find_by_name($name) { $result = pg_query("select * from entries where name='" . pesc($name) . "'"); if ($row = pg_fetch_assoc($result)) { return self::from_row($row); } else { return null; } }
public function delete() { if ($this->id == 0) { return false; } $result = pg_query('update cars set deleted=TRUE where id=\'' . pesc($this->id) . '\''); self::getRows(true); return pg_affected_rows($result) > 0; }