Top "Pdo" questions

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

MySQL check if a table exists without throwing an exception

What is the best way to check if a table exists in MySQL (preferably via PDO in PHP) without throwing …

php mysql pdo database
How do I insert NULL values using PDO?

I'm using this code and I'm beyond frustration: try { $dbh = new PDO('mysql:dbname=' . DB . ';host=' . HOST, …

php mysql pdo null sql-insert
PDO error message?

Here is a snippet of my code: $qry = ' INSERT INTO non-existant-table (id, score) SELECT id, 40 FROM another-non-existant-table WHERE description …

php pdo
How to check if a row exists in MySQL? (i.e. check if an email exists in MySQL)

I need help checking if a row exists in the database. In my case, that row contains an email address. …

php mysql mysqli pdo
How do I create a PDO parameterized query with a LIKE statement?

Here's my attempt at it: $query = $database->prepare('SELECT * FROM table WHERE column LIKE "?%"'); $query->execute(array(…

php pdo
PDO::PARAM for dates?

Does some PDO::PARAM_??? exist which can be used for dates or timestamps? Sample code: $sql = "UPDATE my_table SET …

php mysql date types pdo
PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers

I'm trying to connect to a MySQL database from Symfony 3 application. But when trying to create MySQL schema from a …

php mysql pdo
How to properly set up a PDO connection

From time to time I see questions regarding connecting to database. Most answers is not the way I do it, …

php mysql sql class pdo
Connect PHP to MSSQL via PDO ODBC

When I execute this code: print_r(PDO::getAvailableDrivers()); It says I have the odbc driver available. Array ( [0] => mysql [1] =&…

php sql-server pdo odbc
What is the PDO equivalent of function mysql_real_escape_string?

I am modifying my code from using mysql_* to PDO. In my code I had mysql_real_escape_string(). What …

php mysql pdo sql-injection