Questions tagged as 'pdo'

0
answers

UPDATE PDO, AJAX, PHP Object Oriented

I have the following function within my class public function update(){ try{ $stmt = $this->conn->prepare("UPDATE Tabela SET Dado1 = :Dado1, Dado2 = :Dado2, Dado3 = :Dado3 WHERE DadoId = :DadoId");...
asked by 27.09.2016 / 22:34
1
answer

MySQL UPDATE function is editing right, but creates a new empty line at the end of the table [closed]

I'm breaking my head here, because the UPDATE function works fine when used purely by the terminal or the Workbench, but when I do the PHP code via HTML form parameters, it edits fine too, but creates a new line empty, and will create mor...
asked by 20.10.2015 / 22:42
0
answers

PHP PDO connection with static variable in class

I did a search on connections using singleton in the PDO, most people use a private or protected construct so that if there is no connection the same is created when instantiating a new Class (), but I wrote the code snippet using functions stat...
asked by 07.03.2016 / 21:06
0
answers

GetById and GetAll causing slowness [closed]

I'm doing an application in MVC for study purposes, here the structure: Sketch of my class Model that will be extended by the child classes. <?php abstract class Model { protected $db; protected $table; function __construct(PDO $db, $...
asked by 06.10.2015 / 03:49
0
answers

Logout function using PHP PDO Object oriented [closed]

I'm having a big problem with the panning function, I made a public function Logout () Login.class.php file: public function Logout(){ if($this->isLogged()) { unset($_SESSION[$this->prefix.['email']]); unset($_S...
asked by 16.05.2015 / 09:18
2
answers

Formatting / masking CPF in MySQL or PDO

I have a "cpf" field in my table. This field can be of type INT or VARCHAR, in case I need to change it to solve my problem. In it there are only numerical values, without the dashes and without hyphen (.-). In PHP, when I'm going to call dat...
asked by 16.02.2016 / 22:58
2
answers

Generate csv file in php [closed]

Hello everyone, I'm trying to create a query in php in the mysql database to generate a csv file according to the code below. The problem is that the one that would download the file is presenting an error, I have reviewed it a few times and I d...
asked by 04.06.2016 / 22:12
3
answers

How to do subquery with pdo

I would like to perform a subquery within this query: $ranking = $pdo->query("SELECT * FROM usuarios_emblemas GROUP BY usuario ORDER BY count(usuario) DESC LIMIT 3"); It would be to block the list of users with banned = true, ie I want t...
asked by 05.07.2017 / 19:13
2
answers

PDO error with variable in LIMIT

In PDO today was the first time I had to by a variable in LIMIT, and I'm getting this error:    Fatal error: Uncaught exception 'PDOException' with message   'SQLSTATE [HY093]: Invalid parameter number: number of bound variables   does not ma...
asked by 12.08.2016 / 18:17
3
answers

PDO paging - Problems with prepare (); select ();

Hello, I'm having trouble printing data from a table. Update : I put the following lines in the connection.php file: public function select(){ $sth = $this->prepare("SELECT id_prato, titulo, descricao, preco FROM prato"); $t...
asked by 18.05.2015 / 01:27