Questions tagged as 'pdo'

1
answer

Show latest results however with ASC ordering in PHP

I would like to show the last 10 results found in a table, but with ASC ordering. I'm using the following: $listarResultados = $pdo->prepare("SELECT * FROM teste WHERE categoria = 'cateste' ORDER BY id ASC LIMIT 10"); $listarResultados ->...
asked by 15.08.2015 / 23:15
1
answer

Error in the PDO database

I am creating a page that saves values in the MySql database using PDO and is not writing the data. I'm using the following code: <?php $conexao = new PDO('mysql:host=localhost;dbname=dbTeste', 'root', ''); $query = "INSERT INTO names(...
asked by 14.08.2015 / 20:57
4
answers

Mysql error 1054 Unknown column

I'm doing a SQL that counts how many names in the table begin with any letter but an error is being returned:    Column not found: 1054 Unknown column 'A' in 'where clause' For the following SQL: SELECT COUNT(*) FROM author WHERE name L...
asked by 27.04.2015 / 14:39
2
answers

Data mismatch with inner JOIN using PDO

Hello I'm having problems when I'm returning a select done with inner join from some tables as below: SoIsetupaninnerjoinwithmyneedsinmymethod:publicfunctiontableUsuarioUM(){$consulta=PDOUtil::getStance()->prepare("SELECT pes.id_pessoa, pe...
asked by 23.05.2015 / 20:52
1
answer

Add all the results of a table and separate by day / month

I have a table, where I would like to add all the results and separate them by Day / Month. 01/Abril = 3 Resultados; 03/Abril = 5 Resultados; 02/Maio = 1 Resultado; The table I'm using. **ID -- item_data** 01 || 2018-...
asked by 12.04.2018 / 03:31
1
answer

PDO showing connection data if trigger of catch within the alert (result)

Because in my% ajax%, the catch of alert(result) is showing my connection information to the database as shown in the following image: link Code: $pdo = new PDO("mysql:host=localhost; dbname=meubanco", "meuuser", "minhasenha");...
asked by 30.08.2014 / 20:49
1
answer

Validate data with PDO

I'm migrating my php code in which I was using sql query for PDO, but I'm finding it difficult to validate data with this. NOTE: I already have a functional file that searches the database, my difficulty is really to compare it with POST and...
asked by 20.09.2017 / 17:03
1
answer

PDO suppresses columns with equal names

I noticed that using PDO to execute the query below, the results are conflicting with PhpMyadmin and Console do Mysql : SELECT a.*, n.* FROM arquivo AS a INNER JOIN numeracao AS n ON (a.id_numeracao =...
asked by 08.03.2014 / 06:02
1
answer

How to work with the IN statement in PHP + PDO? [duplicate]

I'm trying to build a dynamic SQL but I'm getting caught by not understanding how to work with the IN statement in the PDO Example: $SQL = "select * from tabela where (campo in(:valor))"; $Query = Database::Prepare($SQL); $Query->bindValu...
asked by 18.08.2017 / 22:20
1
answer

Simultaneous connection to PDO direct banks

I need to make an appointment using 2 different banks simultaneously. One is mysql and another firebird . It is already working separately, I would like to make the connection without having to close one to open the other. Examp...
asked by 25.04.2017 / 19:31