public static function encodeGetAllRecords($tableName, $fields = array(), $limit = 0, $start = 0)
    {
        if ($fields == null)
            $fields = array();

        $select = "";
        $size = sizeof($fields);
        //Select fields to be returned
        if (sizeof($fields) > 0) {
            foreach ($fields as $i => $column) {
                $select .= " $column";
                if ($i != ($size - 1))
                    $select .= ",";
            }
        } else {
            $select = "*";
        }

        $query = "SELECT $select FROM $tableName";

        if ($limit > 0) {
            if ($start > 0) {
                $query .= " LIMIT $start, $limit";
            } else {
                $query .= " LIMIT $limit";
            }
        }

        $query .= ";";

        return $query;
    }