メインコンテンツまでスキップ
Version: Fegg 5.x(開発版)

Pdo::getLastQuery

Get the last executed query for debugging

Description​

public string Pdo::getLastQuery()

Returns the last query run with execute (or built with compile), with the values filled in and quoted. It is for logs and debugging only: never run the result. To get the SQL and the values separately, use getQuery and getParam.

Example​

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

$db->setWhere('title = ?', "it's")->select('cms_news')->execute();

echo $db->getLastQuery();
// -> Select * From "cms_news" Where title = 'it''s' And "cms_news".valid = 1