0
Good guys, I’m using PDO to run my querys
.
SQL:
SELECT Pessoa.IdPessoa, Pessoa.IdPessoa, Pessoa.Nome AS 'Nome', Pessoa.DataNascimento AS 'Nascimento' FROM Pessoa WHERE Pessoa.EstadoCivil = '1'
when I run this sql for example, which brings the field IdPessoa
twice, the PDO return using the function
$result->fetchAll(PDO::FETCH_ASSOC);
Omit one of the results and the query brings an array, but only with a field IdPessoa
[0] => Array
(
[IdPessoa] => 7
[Nome] => Carlos Alberto Martins Barros
[Nascimento] =>
)
)
has something to be done, so that the PDO does not eliminate this duplicity?
only use
$result->fetchAll();
It will bring duplicate results, but it will be all fields, with numeric indexes and indexes named after the Query
, so it wouldn’t serve.
Puts aliases in the second column.
– Don't Panic
I have a similar problem, but it is not in select. It is the Insert that causes this, because every record sent is duplicated in the table.
– user4701