daily pastebin goal
56%
SHARE
TWEET

CRUD Generico aula3

yeshuadesign Feb 12th, 2013 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cadastro_class.php
  2. <?
  3. require_once("Base_class.php");
  4. class cadastro extends base{
  5.         public function __construct($campos=array()){
  6.                 parent::__construct();
  7.                 $this->tabela = "cadastro";
  8.                 if(sizeof($campos)<=0):
  9.                 $this->campos_valores = array(
  10.                         "nome" => NULL,
  11.                         "email" => NULL
  12.                 );
  13.                 else:
  14.                         $this->campos_valores = $campos;
  15.                 endif;
  16.                 $this->campopk = "id";
  17.                 $this->valorpk = "id_cli";
  18.         }//construct
  19.        
  20. }//fim cadastro
  21. ?>
  22.  
  23. teste.php
  24.  
  25. <?
  26. require_once("classes/cadastro_class.php");
  27.  
  28. $cadastro = new cadastro();
  29. $cadastro->setValor('nome','Juliano');
  30. $cadastro->setValor('email','julianobalbis@gmail.com');
  31.  
  32.  
  33. $cadastro->inserir($cadastro);
  34. echo '<pre>';
  35. print_r($cadastro);
  36. echo '</pre>';
  37. echo $cadastro->linhasafetadas.' Registro(s) incluido(s) com sucesso!';
  38. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top