function create_view($view, $data, $table, $join)
{
$sql = "CREATE OR REPLACE VIEW `" . $view . "` AS SELECT ";
$values = array();
foreach ($data as $key => $value) {
$_str_view = "`" . $value[1] . "`.`" . $value[0] . "`";
if (isset($value[2])) {
$_str_view .= " AS `" . $value[2] . "`";
} else {
$_str_view .= " AS `" . $value[0] . "`";
}
$values[] = $_str_view;
}
$sql .= implode(",", $values);
$sql .= " FROM `" . $table . "` " . $join;
//print_r($sql);
$this->db_rs = $this->query($sql);
return $this->db_rs;
}