Questions tagged as 'pdo'

1
answer

PDO bindValue parameter passing

I have the following parameter in my UPDATE query. $consulta->bindValue(':foto', $foto, PDO::PARAM_STR); What I would like to do is this: If the variable $foto is blank, how could I pass the same value I have in the database?...
asked by 16.09.2016 / 00:39
1
answer

Which of these 3 PDO codes has the best performance?

Purpose: Select a single line with LIMIT 1 Internal Use: The selects receive internal parameters only You do not need PREPARE because there are no external user data $pdo = new PDO("mysql:host=A.com;dbname=B; c...
asked by 07.02.2018 / 03:59
1
answer

Call to undefined method PDO :: bindParam (), how do I resolve it?

So, guys, I'm starting OO studies and I decided to take a look at PDO, but it's not going to happen, please help me: class Cliente { private $nome; private $email; private $telefone; protected $cpf; protected $senha; pri...
asked by 08.12.2016 / 01:05
2
answers

Adding value from an array

I need to do the sum of values provided by an array. The array comes from a select in the database. The array looks like this: Array ( [0] => Array ( [valorPagamento] => 12 ) [1] => Array ( [valorPagamento] =>...
asked by 20.03.2016 / 21:00
2
answers

Php connection to SQL Server

How can I connect to php with sqlserver (pdo)? It sounds simple, but I can not ... Already enabled the driver everything ok Attached is the name of the server, I'll run it on the site ...     
asked by 10.02.2017 / 00:08
1
answer

How to send more than one value through return

I am performing a query in the database and want to return more than one query value how do I do this? The structure of my table and the following Id_idx | name | OUTROS | Each Id_idx can be repeated up to 3 times I want to count how man...
asked by 10.12.2017 / 22:46
1
answer

red / negative and green / positive

I have a table that, time value is negative, and time is positive. I would like these values to be green or red. But I could not do that. Currently my select is being rendered this way: (php, myadmin, pdo) <?php $sql = $pdo->pr...
asked by 01.01.2019 / 00:25
2
answers

Code only returns me the first line of the table referring to the patient ID

The code only returns me the first line of the table for the patient ID <?php require 'conexao.php'; // Recebe o id do exame do exame via GET $id_exames = (isset($_GET['id'])) ? $_GET['id'] : ''; // Valida se existe um id e se ele é numé...
asked by 14.12.2016 / 03:34
4
answers

Write MYSQL data in pt-br / UTF8 format

How do I save data in the database in Brazilian format with accents, I used this in connection mysqli_set_charset($conexão, 'utf8'); But now my code is all in PDO how do I save this data in utf8 in PHPMyadmin database? <?php /...
asked by 15.10.2015 / 01:45
2
answers

PDO Execute () returns false [closed]

I'm practicing Object Oriented PHP (OOP) and I'm developing a system for student enrollment, but when I try to enroll a student, the execute() returns false and I could not identify the problem. Follow the code Student.php: &l...
asked by 18.05.2017 / 15:57