'text', 'timestamp' => 'text', 'data' => 'text' ); private $base_object; function __construct($base_object) { $this->base_object = $base_object; $this->db = $base_object->db; } // end __construct public function get_data($id) { if ($this->id) { $sql = "SELECT * FROM cache WHERE id='".$this->db->real_escape_string($id)."'"; $result = $this->db->query($sql); $obj = $result->fetch_object(); if ($obj) { return $obj; } } return false; } // end get_data public function delete($id) { $sql = "DELETE FROM cache WHERE id='".$this->db->real_escape_string($id)."'"; $this->db->query($sql); return; }// end delete public function set($data) { if ($data) { $sql = "INSERT INTO countries SET "; foreach ($data as $var_name => $value) { $value = $this->db->real_escape_string($value); if ($this->object_fields[$var_name] == 'integer') { $sql .= $var_name.' = '.$value.', '; } else { $sql .= $var_name.' = "'.$value.'", '; } } $sql = substr($sql, 0, -2); $this->db->query($sql); $this->id = $this->db->insert_id; } return; } // end create } // end Country