Questions tagged as 'pdo'

1
answer

Double registration in the database?

I have already rolled my code and found the reason that it is adding two records in the database. Function: public static function create($table, array $params) { $key = array_keys($params); $value = array_values($params); $key...
asked by 20.02.2016 / 01:36
1
answer

How do I select all the records in the table

How do I select all the records in the select below: $select = "SELECT COUNT(1) AS id_mark, SUM(a.rate) AS rate, b.name_mark, b.id FROM tb_comment a, tb_mark b WHERE a.id_mark=b.id AND b.id_category=:id_c GR...
asked by 17.12.2015 / 19:45
1
answer

Error trying to execute PDO Insert function - PHP

I'm trying to create a PDO function to execute two inserts, one after the other, but I'm having trouble. The function code is: public function double_cad(array $dados){ $pdo = parent::getDB(); $double_cad = $pdo->prepare("insert...
asked by 24.10.2015 / 16:08
1
answer

Help with PHP Edit PDO

I'm pulling data from a table in sqlsrv to a table html, because I need to frequently edit this data in that table. So I created a php function edit to edit the table row in another page only that is not working does not return me nor one value....
asked by 11.01.2016 / 14:59
1
answer

Predict the next Bank ID

if (is_uploaded_file($_FILES["foto"]["tmp_name"])) { $imagem = time() . '_' . $_FILES["foto"]["name"]; $diretorio = 'fotos/ {{{AQUI VIRIA O NUMERO DO ID }}}' . $imagem; if (!move_uploaded_file($_FILES["foto"]["tmp_name"], $diretorio)) {...
asked by 01.10.2015 / 22:51
1
answer

Return value from select

$sql = "SELECT username, mail, password FROM users WHERE username = :user_name OR mail = :user_name;"; $query = $this->db->prepare($sql); $query->bindParam(':user_name', $user_name); $query->bindParam(':user_password', $user_password...
asked by 22.06.2015 / 20:03
1
answer

Best form tag Select in Php without framework with DAO project pattern

I'm having a question about how best to implement a method that traverses a common select using DAO standard with PDO. It would be appropriate for me to do this, my whole code in the view: $conexao = new PDOUtil (); $consulta = $conexao->...
asked by 29.04.2015 / 05:24
1
answer

Unlink to multiple files

I am trying to use the unlink to delete from a directory several images I do not know what is happening apparently the logic is correct, my method is as follows: public function deleteImagem($id) { $selectDasImagens = PDOUtil::getStance()-...
asked by 14.06.2015 / 02:24
1
answer

How to view the SQL executed by php when using the "prepare ()" and "execute ()" functions?

Hello, I need to give an echo or print in the SQL executed from the function below. The goal is to visualize how SQL will look when the values of "?" replaced. Does anyone know how I can do this? public function insert (EmployeeTO $ employeeT...
asked by 04.01.2015 / 01:43
1
answer

Error when trying to rowCount in class with PHP

I'm trying to make a rowCount using a class I myself developed for the connection and some functions involving bd. I have the following PHP class: class Banco { private $debug; private static $pdo; function __construct($debug =...
asked by 18.04.2015 / 05:05