toda razão
vamos melhora-la

Em 28 de junho de 2010 21:14, Vinicius Cruz <[email protected]> escreveu:

> Legal a iniciativa, Cliff.
>
> Mas uma dica: em caso de houver falha ao inserir registro no banco, sempre
> terei TRUE como retorno?! :-)
> A idéia é sempre aprimorar a classe.
>
> Abraço!
>
> Att,
> Vinicius Cruz
> http://twitter.com/vinaocruz
> http://www.viniciuscruz.com/
>
>
> Em 28 de junho de 2010 20:50, Cliff Oliveira 
> <[email protected]>escreveu:
>
>> Saudaçoes
>>
>> a lista já me ajudou muito, por isso posto aqui um CRUD genérico que
>> usamos aqui na Tribo
>> ele tem me ajudado em muita coisa e espero que seja útil tbm a alguém :
>>
>> <?php
>> /*
>>  * To change this template, choose Tools | Templates
>>  * and open the template in the editor.
>> */
>> class crud_model extends Model {
>>     function _construct() {
>>         parent::Model();
>>         $this->load->database();
>>     }
>>     function inserir($table, $array) {
>>         $this->db->insert($table, $array);
>>         return true;
>>     }
>>     function atualizar($table, $id_name, $array) {
>>         $this->db->where($id_name,$array[$id_name]);
>>         $this->db->update($table, $array);
>>         return true;
>>     }
>>     function deletar($table, $id_name, $array) {
>>         $this->db->where($id_name,$array[$id_name]);
>>         $this->db->delete($table);
>>         return true;
>>     }
>>     function mostrar($table) {
>>         $query = $this->db->get($table);
>>         return $query;
>>     }
>>     function mostrar_onde($table, $array) {
>>         $query = $this->db->get_where($table, $array);
>>         return $query;
>>     }
>>
>>     function mostrar_ordenado($table, $array, $col, $how) {
>>         $this->db->select('*');
>>         $this->db->from($table);
>>         $this->db->where($array);
>>         $this->db->order_by($col, $how);
>>         $query = $this->db->get();
>>         return $query;
>>     }
>>
>>
>> }
>> ?>
>>
>>
>> --
>> Cliff Oliveira
>> www.tribodeideias.com.br
>>
>> _______________________________________________
>> Lista mailing list
>> [email protected]
>> http://codeigniter.com.br/mailman/listinfo/lista_codeigniter.com.br
>>
>>
>
> _______________________________________________
> Lista mailing list
> [email protected]
> http://codeigniter.com.br/mailman/listinfo/lista_codeigniter.com.br
>
>


-- 
Cliff Oliveira
www.tribodeideias.com.br
_______________________________________________
Lista mailing list
[email protected]
http://codeigniter.com.br/mailman/listinfo/lista_codeigniter.com.br

Responder a