CLASS_MYSQLI::count PHP Метод

count() публичный Метод

public count ( $table, $where = "", $distinct = "" )
    function count($table, $where = "", $distinct = "")
    {
        $sql = "SELECT";
        if ($distinct) {
            $sql .= " COUNT(DISTINCT `" . implode("`,`", $distinct) . "`) FROM `" . $table . "`";
        } else {
            $sql .= " COUNT(*) FROM `" . $table . "`";
        }
        if ($where) {
            $sql .= " WHERE " . $where;
        }
        //print_r($sql);
        $this->db_rs = $this->query($sql);
        if (!$this->db_rs) {
            return false;
        }
        $obj_temp = $this->fetch_row($this->db_rs);
        return $obj_temp[0];
    }