You don't have access to $con from within your function. The global statement can be used to create a reference to $con from within your function. rows were affected by a DELETE, INSERT, REPLACE, or UPDATE The query string should not end with a semicolon. Simulating an atomic operation for application locks using mysql. How to maximize "contrast" between nodes on a graph? Thanks - this and removing the single quotes were what I needed to fix it. If no connection is found or established, an Second, the table name cannot be enclosed in single quotes. If I give php -i command mysql support is showing as enabled. I was able to determine the issue and get the query working as desired. To skip warning messages, you could use something like: error_reporting(E_ERROR | E_PARSE); Ref : https://bit.ly/3f6xclG Also, you didn't supply enough PDO code for me to simply copy and paste to make it work. Has anyone any idea why this is not working. Perform query against a database: