Get Started

Upgrade

Where Syntax

Query

Aggregation

Fetch

Transaction

Management

Advanced

Raw object

PDO object

Debug

Information

version: 2.1.12

log

Return all executed queries.

log()
Return: [array] Array with all executed queries.
This function will only return all records if set `logging => true` on initialization, otherwise it will only return one last record by default.
$database = new Medoo([
	"type" => "mysql",
	"host" => "localhost",
	"database" => "name",
	"username" => "your_username",
	"password" => "your_password",

	// Enable logging.
	"logging" => true,
]);

$database->select("account", [
	"user_name",
	"email"
], [
	"user_id[<]" => 20
]);

$database->insert("account", [
	"user_name" => "foo",
	"email" => "foo@bar.com"
]);

var_dump($database->log());
// array(2) {
//	[0]=> string(62) "SELECT "user_name","email" FROM "account" WHERE "user_id" < 20"
//	[1]=> string(74) "INSERT INTO "account" ("user_name", "email") VALUES (\'foo\', \'foo@bar.com\')"
// }

// Will output only one last record if "logging" => false or ignored by default on initialization
// array(1) {
//	[0]=> string(74) "INSERT INTO "account" ("user_name", "email") VALUES (\'foo\', \'foo@bar.com\')"
// }