Tagged articles
PDO
29 articles · Page 1 of 1
This guide explains the advantages of using PDO instead of mysqli for PHP database connections, walks through MySQL and PostgreSQL setup with detailed code examples, recommended configuration options, and a checklist for troubleshooting common connection errors.
BackendMySQLPDO
0 likes · 7 min read

Learn how to establish, use, and close MySQL database connections in PHP with detailed MySQLi and PDO examples, covering object‑oriented syntax, prepared statements, error handling, and best practices for secure and efficient backend development.
Database ConnectionMySQLMySQLi
0 likes · 4 min read

Learn how to accelerate PHP database operations by employing persistent connections, implementing a connection pool, and caching query results, with clear code examples for mysqli, PDO, and Memcached that illustrate each optimization technique and its impact on reducing latency and resource usage.
CachingMemcachedPDO
0 likes · 5 min read

This tutorial walks you through establishing MySQL connections in PHP using both the mysqli extension and PDO, covering procedural and object‑oriented code, prepared statements, error handling, and proper connection closure for robust backend development.
BackendMySQLMySQLi
0 likes · 4 min read

This article introduces ten lesser‑known PHP tricks—including memory management, Composer dependency handling, the built‑in web server, anonymous classes, try‑catch error handling, generators, traits, built‑in functions, PDO, and namespaces—to help developers write more efficient, maintainable, and secure code.
BackendComposerPDO
0 likes · 9 min read

This article recounts how developer Saki discovered a PDO extension incompatibility after PHP 8.1 upgrade, submitted detailed bug reports and pull requests, added unit tests, resolved further SQL Server issues, and ultimately became a PHP core contributor, illustrating the open‑source contribution process.
BackendPDOPHP
0 likes · 7 min read

This guide introduces Medoo, a lightweight PHP database framework built on PDO, outlines its key features, shows installation via Composer, demonstrates basic CRUD operations, and explains integration with the Webman framework, including multi‑database configuration and usage examples.
CRUDComposerMedoo
0 likes · 4 min read

This tutorial explains how to connect PHP to databases using both mysqli and PDO, covering connection setup, error handling, executing queries, and properly closing the connection, with complete code examples for each method.
Database ConnectionMySQLMySQLi
0 likes · 4 min read

This tutorial explains how to use PHP and PDO to quickly insert ten million rows into a remote MySQL database by preparing the connection, employing batch inserts, managing transactions, tuning MySQL settings, and optionally using the LOAD DATA statement for optimal performance.
MySQLPDOPHP
0 likes · 6 min read

This article demonstrates how to build a simple data search feature by creating a PHP backend API using PDO for database queries and a Vue.js frontend that sends Ajax requests, processes the JSON response, and displays matching student records in a list.
Data SearchPDOPHP
0 likes · 6 min read

This article explains how PHP can connect to various databases, execute queries, fetch results, insert or update records, close connections, handle errors, and address security concerns, providing code examples for both MySQLi and PDO extensions.
MySQLiPDOPHP
0 likes · 5 min read

This article explains how to debug and optimize PHP database connections using PDO and mysqli, demonstrates error handling and logging techniques, and presents performance improvements such as persistent connections, connection pooling, and query optimization with practical code examples.
DebuggingPDOPHP
0 likes · 6 min read

The article explains why directly concatenating user input into SQL queries leads to injection vulnerabilities and demonstrates how to secure PHP database operations using input validation, escaping functions, and prepared statements with MySQLi and PDO, while comparing related sanitization functions.
MySQLiPDOPHP
0 likes · 5 min read

This article explains how PHP's prepared statements and parameterized queries, especially using the PDO extension, protect against SQL injection by compiling query templates, binding parameters safely, and avoiding repeated parsing, while also showing practical code examples and Laravel's underlying implementation.
PDOPrepared Statements
0 likes · 5 min read

PDO::errorCode is a PHP method that returns the SQLSTATE code—a five‑character identifier defined by the ANSI SQL standard—representing the outcome of the most recent operation on a database handle, or NULL if no operation has been performed.
PDOPHPSQLSTATE
0 likes · 1 min read

The article explains the PHP PDO::setAttribute method, describing its syntax, purpose of setting database handle attributes, available generic attributes, return values, and notes that some drivers may support additional specific attributes for.
BackendPDOPHP
0 likes · 1 min read

The PDO::inTransaction method returns a boolean indicating whether the current database connection is actively inside a transaction, works only with drivers that support transactions, takes no parameters, and returns TRUE on success and FALSE on failure.
BackendPDOPHP
0 likes · 1 min read

The article explains how the PHP PDO::rollBack() method aborts the current transaction, restores autocommit mode when needed, outlines its parameter‑less signature, return values, and provides a complete code example demonstrating transaction handling and rollback behavior.
BackendPDOPHP
0 likes · 2 min read

PDO::inTransaction is a PHP PDO method that returns a boolean indicating whether the current database connection is actively within a transaction, applicable only to drivers that support transactions, and it takes no parameters.
BackendPDOPHP
0 likes · 1 min read

The PDO::lastInsertId method returns the identifier of the most recently inserted row or, when a sequence name is provided, the last value of that sequence, with behavior depending on the specific database driver and optional parameters.
BackendPDOPHP
0 likes · 2 min read

The article explains the PDO::getAttribute method, lists all PDO::ATTR_* constants that can be queried, describes its return behavior, and provides a PHP example demonstrating how to retrieve multiple connection attributes for debugging.
BackendPDOPHP
0 likes · 2 min read

The article explains PHP's PDO::exec method, detailing its signature, parameters, return value, and provides a complete example showing how to delete rows from a database table and retrieve the count of affected rows.
BackendPDOPHP
0 likes · 2 min read

The PDO::__construct method creates a PDO object that represents a connection to a database, detailing its parameters—DSN, username, password, and driver options—return value, and providing a complete PHP example of establishing and handling a MySQL connection.
BackendPDOPHP
0 likes · 2 min read

This article explains how to use PHP's PDO::quote function to safely add quotes to strings for SQL statements, describes its syntax and parameters, and provides two practical code examples demonstrating quoting of normal and potentially dangerous strings.
PDOSecurityquote
0 likes · 3 min read

This article explains the PDOStatement::fetch() method in PHP, detailing the available fetch style constants, their effects on result set formatting, and shows how to configure the statement to return only associative arrays for cleaner data handling.
BackendFetchModePDO
0 likes · 3 min read

This article explains how to manage database write and query operations in PHP using PDO, covering initialization, error handling, and providing complete code examples for inserting and selecting records.
CRUDPDOPHP
0 likes · 4 min read


21CTOOct 4, 2019 · Backend Development
This article demonstrates how PHP7's generator functions can be used to create lightweight context managers for file handling and PDO transactions, resulting in cleaner, more maintainable backend code.
BackendPDOPHP
0 likes · 4 min read

This article investigates why slow‑query logs show numerous slow queries without visible SQL statements, reproduces the problem using MySQL client, Perl and PHP simulations, compares local (emulated) and server‑side PDO prepare modes, and provides practical recommendations for configuring prepared statements to avoid hidden performance bottlenecks.
Database PerformanceMySQLPDO
0 likes · 7 min read

The article reviews the author’s experience with security testing, explains the severe risks of SQL injection, demonstrates vulnerable server‑side code, and provides practical remediation methods such as input sanitization, type casting, and using prepared statements with PDO.
Database SecurityPDOSQL injection
0 likes · 5 min read
