PHP/PDO: How to get the current connection status

connection, database-connection, pdo, php

Solution

I cannot get credit for this answer. Someone posted the answer, but he/she latter deleted the entry.

Here's the `(saved archived)` answer to your question:

$status = $conn->getAttribute(PDO::ATTR_CONNECTION_STATUS);

Problem

What is the PDO equivalent of: ``` mysqli_stat($dbConn); ``` P.S. I use it to (get a message to) make sure I am connected

Original source