Questions tagged as 'pdo'

1
answer

How to reduce the INSERT script in DB with PDO - bindValue?

Some way to shorten this script ?? Or every time I make a INSERT in the database using PDO and the bindValue function, will I have to write row by line ?? Or you can use an array or something faster and easier. //Prepara o ca...
asked by 04.02.2016 / 16:27
1
answer

Can not use object of type stdClass as array

I made a code to verify that the user and email are already exist, but when the user exists it returns the following error:    Fatal error: Fatal error: Can not use object of type stdClass as array $query_check_user_name = $this->db->...
asked by 14.07.2015 / 17:48
1
answer

commit / rollback in two tables with PDO

First of all, the code below works, there is no error (but possibly can be improved). I have the following method in PHP: <?php public function ajustarUnidadeServidor($ajusteExercicio){ try { $sqlInsert = "INSERT INTO tb_ajuste_...
asked by 30.09.2015 / 00:43
1
answer

"Insert value list does not match column list" error with PDO

Hello, I've done a questionnaire, and it's returning the following error: Error: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1 Warning: Cannot modify header information...
asked by 22.05.2015 / 07:32
1
answer

PDOStatement :: execute () error: SQLSTATE [HY093]: Invalid parameter number [closed]

I have the following code, I used another similar one to do an update of the database, but this one now does not work; it gives the following error:   Warning: PDOStatement :: execute (): SQLSTATE [HY093]: Invalid parameter   number: paramete...
asked by 02.06.2015 / 21:24
1
answer

Change image upload from mysql_query to PDO

I would like to change this code that is working with mysql_* to PDO : <?php if ( isset($_POST['enviar']) ) { $arquivo = $_FILES['arquivo']['name']; $update = mysql_query("UPDATE cabecalho SET logo = '$logo"); if (...
asked by 13.05.2015 / 20:46
1
answer

Encrypt password and log in PHP and PDO

Login.php file <?php session_start(); require_once '../includes/config.php'; if(isset($_REQUEST["post_back"])){ $tb = $conn->prepare("select nm_usuario, imgPerfil, nome from usuario where nm_usuario=:usuario and s...
asked by 28.12.2014 / 04:27
1
answer

How to insert into the database with prepared statements? Problem with ID

I'm having column count problems because I do not know how to enter data by PDO when it has a id AUTO_INCREMENT that comes before the nome variable. I'm not exactly sure how to enter id along with the other data. Ther...
asked by 24.10.2014 / 17:55
1
answer

How to call the PDO on file other than the system?

I have a programming problem in which I put my PDO-type connection in the header and need to have $pdo called in any other file on the system. Example:    header.php <?php require("configs/conexao.php"); ?>    index.php...
asked by 31.10.2014 / 18:48
1
answer

Image Upload saved only first image in the database

I have the following image upload code if(isset($_POST['upload'])){ //INFO IMAGEM $file = $_FILES['img']; $numFile = count(array_filter($file['name'])); //PASTA $folder = 'upload'; if($numFile <= 0)...
asked by 19.06.2015 / 12:07