how can I create and model a table with attributes in the database with the PDO using array?

Asked

Viewed 28 times

1

I’ve already got this method following some examples I’ve seen around but I still don’t quite understand how I’m going to go through this array and turn the table attributes

public static function Colluns($database,$tables)
{
  #'id_pessoa' => 'type' => ['alias' => 'ID','typedata' => 'text'],
    switch ($database)
    {
        case 'BIGDATA':

            switch ($tables)
            {
                case '_rm':
                    return [ 
                          'nome'=> 'type' => ['alias'=> 'NOME ','typedata' => 'text'],
                            'cpf' => 'type' => ['alias' => 'CPF','typedata' => 'cpf'],
                            'logradouro'=>'type' => ['alias' => 'LOGRADOURO','typedata' => 'text'],
                            'endereco'=>'type' => ['alias' => 'ENDERECO','typedata' => 'text'],
                            'numero'=>'type' => ['alias' => 'NUMERO','typedata' => 'text'],
                            'complemento'=>'type' => ['alias' => 'COMPLEMENTO','typedata' => 'text'] ,
                            'bairro'=>'type' => ['alias' => 'BAIRRO','typedata' => 'text'],
                            'cidade'=>'type' => ['alias' => 'CIDADE','typedata' => 'text'] ,
                            'uf'=>'type' => ['alias' => 'UF','typedata' => 'text'],
                            'cep'=>'type' => ['alias' => 'CEP','typedata' => 'cep'] ,
                            'e_mail'=>'type' => ['alias' => 'EMAIL','typedata' => 'email'],
                            'local'=>'type' => ['alias' => 'LOCAL','typedata' => 'text'],
                            'cidade_local'=>'type' => ['alias' => 'CIDADE_LOCAL','typedata' => 'text'],
                            'professor'=>'type' => ['alias' => 'PROFESSOR','typedata' => 'text'],
                            'cargo'=>'type' => ['alias' => 'CARGO','typedata' => 'text'] ,
                            'tel_comercial'=>'type' => ['alias' => 'TELEFONE','typedata' => 'telefone'],
                            'tel_celular'=>'type' => ['alias' => 'CELULAR','typedata' => 'telefone']
                            ];
                    break;
 ......code ......
                }
          break;
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.