Questions tagged as 'pdo'

1
answer

Use PDO prepared statements in function

I've been reading about preventing sql injections and seen using prepared statements might help. I have the following function in a class for crud that I have developed: public function inserir($tabela, $campos, $dados) { try {...
asked by 18.04.2015 / 16:50
1
answer

Keep connection open in webservice php

I am building a simple webservice and PHP + JSON where I have 2 tables and intend to carry out CRUD operations. It is possible that the medium-term webservice consumed by many devices at the same time, which in my opinion can lead to many concur...
asked by 03.02.2015 / 13:18
3
answers

Empty multiple tables in a single run

Via PDO , I can do the TRUNCATE (English) of a table as follows: // Matriz de definições $dbcon_new = array( "host" => "localhost", "dbname" => "bubu", "username" => "super_dragon", "password" =>...
asked by 17.02.2014 / 17:25
1
answer

How do I correctly pass the data type by PDO

In the php snippet below, what kind of PDO :: PARAM should I use? $cnx = new PostgreSQL(); //Classe de conexão do banco $data = '2015-02-13'; $select = 'SELECT * FROM eventos WHERE "data" = :data'; $query -> prepare($select); $query -> b...
asked by 13.02.2015 / 18:33
1
answer

How to use the class PDO in this situation

I am using the PDO class to connect the database but in this particular situation I do not know how to use the PDO because in the mysql_fetch parameter I need to put a variable and for what I researched with the class PDO it is not the same way....
asked by 25.11.2014 / 15:57
1
answer

Function for file upload

I'm trying to create a function that takes 1 value from a input do tipo texto and 1 file. I was able to move the file to the folder however I am not able to develop SQL to insert the file name into the database. The ID and name is u...
asked by 11.08.2015 / 20:24
0
answers

PHP Class PDO runs all CRUD on local server when over for web only works select [closed]

I have a problem that I could not resolve. I already researched here and found nothing like it. I have an application in PHP, using the class PDO to connect to the database. Then I have the CRUD: SELECT , INSERT , UPDATE E...
asked by 13.01.2015 / 17:59
4
answers

Column 'idusuario' in where clause is ambiguous

I'm trying to make a select with inner join . Running the select in phpmyadmin the ERR that returns is this:    Column 'idusuario' in where clause is ambiguous <?php $idusuario = $_GET['idusuario']; $getCli=...
asked by 12.09.2017 / 16:43
1
answer

Connection Progress database by PHP (Laravel framework), PDO

I need to connect to a Progress database via php I'm using the laravel 5.2 framework but the same documentation supports only the MySQL, Postgres, SQLite and SQL Server databases. Searching I found very little about how to connect to this DB...
asked by 24.06.2016 / 16:04
4
answers

Leave last 12 records and delete the rest in PHP / MySQL

I would like to make sure that after the script runs, there may only be the last 12 records in a specific table that has the date field in international format if you can assist. <?php # Este pequeno script PHP recupera o OD do imóvel visi...
asked by 29.09.2014 / 18:14