function select($table, $data = "", $where = "", $group = "", $order = "", $length = 0, $start = 0, $distinct = "", $field = false)
{
$sql = "SELECT";
if ($data) {
if ($field) {
$sql .= " " . implode(",", $data);
} else {
$sql .= " `" . implode("`,`", $data) . "`";
}
} else {
$sql .= " *";
}
if ($distinct) {
$sql .= ", COUNT(DISTINCT `" . implode(",", $distinct) . "`)";
}
$sql .= " FROM `" . $table . "`";
if ($where) {
$sql .= " WHERE " . $where;
}
if ($group) {
$sql .= " GROUP BY " . $group;
}
if ($order) {
$sql .= " ORDER BY " . $order;
}
if ($length > 0) {
$sql .= " LIMIT " . $start . ", " . $length;
}
//print_r($sql);
/*if ($field) {
print_r($sql . "\n");
}*/
$this->db_rs = $this->query($sql);
if (!$this->db_rs) {
return false;
}
$obj = array();
while ($obj_temp = $this->fetch_assoc($this->db_rs)) {
$obj[] = $obj_temp;
unset($obj_temp);
}
return $obj;
}