Skip to main content
Version: Fegg 5.x (next)

Pdo::getLastQueryDebug

Get the last executed query and parameter separately for debugging

Description​

public array Pdo::getLastQueryDebug()

Returns array('query' => ..., 'parameter' => ...): the last query with its ? placeholders, and the values bound to them.

Example​

Controller
$db = new \Fegg\Database\Pdo();

$db->setWhere('category = ?', 2)->select('cms_news')->execute();

print_r($db->getLastQueryDebug());
Output
Array
(
[query] => Select * From "cms_news" Where category = ? And "cms_news".valid = 1
[parameter] => Array
(
[0] => 2
)

)