Top "Pdo" questions

PDO (PHP Data Objects) is a data-access abstraction layer (interface) for PHP.

What is the best way to insert multiple rows in PHP PDO MYSQL?

Say, we have multiple rows to be inserted in a table: $rows = [(1,2,3), (4,5,6), (7,8,9) ... ] //[ array of values ]; Using PDO: $sql = "insert into `…

php mysql pdo sql-insert
Why does PDO print my password when the connection fails?

I have a simple website where I establish a connection to a MySQL server using PDO. $dbh = new PDO('mysql:…

php mysql security connection pdo
lastInsertId does not work in Postgresql

I am using Postgresql, when I want to use PDO to retrieve the latest insertion ID, I got a problem. …

php postgresql pdo lastinsertid
PDO - lastInsertId() for insert query with multiple rows

I can insert 2 pets into a table, and get their lastInsertId() for further processing one at a time (2 queries). I …

mysql pdo last-insert-id
PDO lastInsertId issues, php

I have tried lots of ways to get the last inserted ID with the code below (snipplet from larger class) …

php pdo lastinsertid
Binding params for PDO statement inside a loop

I'm trying to bind parametres for SQL query inside a loop: $db = new PDO('mysql:dbname=test;host=localhost', 'test', …

php foreach pdo prepared-statement
Mocking The PDO Object using PHPUnit

I'm having difficulty mocking the PDO object with PHPUnit. There doesn't seem to be much information on the web about …

php unit-testing pdo phpunit
Constraint violation / Duplicate key when reindexing Magento

I am using Magento CE 1.6.2 and I have a problem with my reindexer ( the url_rewrite ) php shell/indexer.php …

magento pdo duplicates constraints zend-db
SQL Server error 1934 occurs on INSERT to table with computed column PHP/PDO

After adding a computed column to a table in SQL Server 2005 I am getting the following message on INSERT, only …

php sql-server pdo freetds
Create SQLite database in memory

Trying to learn a bit about PDO and is going through this tutorial. It has the following snippet of code: &…

php database sqlite pdo in-memory-database