-
Notifications
You must be signed in to change notification settings - Fork 2
Home
O repositório MinPDO, nele encontramos uma série de funções destinadas a ajudar iniciantes na linguagem PHP na integração de suas aplicações mais rapidamente e de maneira segura, sem ter grande conhecimento de SQL.
The MinPDO repository, it found a number of functions designed to help beginners in PHP language to integrate their applications more rapidly and securely, without having great knowledge of SQL.
A configuração inicial é simples, basta abrir o arquivo minpdo.php e na função conectar(), alterar as variáveis $sgbd, $dbhost, $dbname, $dbuser, $dbpass para suas credenciais do banco de dados.
The initial setup is simple, just open the main file minpdo.php and function conectar(), change the variables $sgbd, $dbhost, $dbname, $dbuser, $dbpass for your database credentials.
No arquivo php/minpdo.php temos as funções conectar(), atualizar(), consultar(), deletar() e minwhere(). Segue suas definições:
conectar(): Não recebe nenhum parâmetro, serve para conectar ao banco de dados;
atualizar(): Tem a definição function atualizar($tabela, $colunas, $valores, $where), onde $colunas e $valores podem ser arrays ou não, e_ $where_ tem a possibilidade de receber ou nao ' '(aspas). O objetivo da função é atualizar dados de uma tabela;
consultar(): Tem a definição function consultar($tabela, $coluna = "*", $where = NULL, $ordem = NULL, $limite = NULL, $like = NULL), onde o valor $coluna pode receber NULL, '*' ou uma coluna do banco, $where tem a possibilidade de receber ou nao ' '(aspas), $ordem deve receber o nome da coluna e um sinal de + ou - (ASC e DESC, respectivamente), exemplo: 'id-',$limite recebe um valor numérico para adotar um limite da consulta e $like recebe a expreção 'busca', '%busca' ou '%busca%' . O objetivo da função é consultar dados de uma tabela e retornar um array com o resultado;
inserir(): Tem a definição function inserir($tabela, $colunas, $valores), onde $colunas e $valores podem ser arrays ou não, serve para inserir dados em uma tabela do banco de dados;
deletar(): Tem a definição function deletar($tabela, $where = NULL), onde $where tem a possibilidade de receber ou não ' '(aspas), e caso seja NULL apagará a tabela intera, serve para deletar dados ou uma tabela do banco de dados;
minwhere(): Tem a definição function minwhere($where), é uma função interna as anteriores, não deve ser usada diretamente;
In php/minpdo.php file functions we conectar(), atualizar(), consultar(), deletar() e minwhere(). Follows your settings:
conectar(): You do not receive any parameters, serves to connect to the database;
atualizar(): Has the definition function atualizar($tabela, $colunas, $valores, $where), where $colunas and $valores may be arrays or not, and $where has the ability to receive or not '' (quote). The purpose of the function is to update data in a table;
consultar(): Has the definition function consultar($tabela, $coluna = "*", $where = NULL, $ordem = NULL, $limite = NULL, $like = NULL) where the value $coluna can receive NULL, '*' or a column of the bank, $where have the ability to receive or not '' (quote), $ordem to receive the column name and a + or - sign (ASC and DESC, respectively), ie 'id-' $limite receives a numerical value to adopt a query limit and $like expression like 'search', '% search' or '% search%'. The purpose of the function is to query data from a table and returns an array with the result;
inserir(): Has the definition function inserir($tabela, $colunas, $valores) of $colunas and $valores may be arrays or not, serves to insert data into a table from the database;
deletar(): Has the definition function deletar($tabela, $where = NULL), where $where have the possibility of receiving a '' (quotes), and if NULL delete the interaction table serves to delete data or a database table data;
minwhere(): Has the definition function minwhere($where) is an internal function of the above should not be used directly;