Skip to content
Advertisement

Tag: pdo

PDO Exception Questions – How to Catch Them

I’m using PDO to re-write a website interface for a database. I used to use the mysql extension, but I had never bothered with error handling, and the few error handlers I had were basically copy-paste. Now I’d like to do this right. However, I’m having issues catching the errors how I’d like (errors like “Duplicate Entry”, “Null Value” etc

Getting a PDO query string with bound parameters without executing it

Is it possible to get a query string from a PDO object with bound parameters without executing it first? I have code similar to the following (where $dbc is the PDO object): Currently, this will echo out a SQL statement like: “SELECT * FROM users WHERE username = ?”. However, I would like to have the bound parameter included so

Advertisement