Get Started

Medoo 1.4

Where Syntax

Query

Fetch

Transaction

Advanced

PDO object

Debug

Information

version: 1.4.5

log

Return the all executed queries.

log()
Return: [array] an array with all executed queries
This function will only retrun all records if setting `logging => true` on initialization, otherwise will only return one last record by default.
$database = new Medoo([
	"database_type" => "mysql",
	"database_name" => "name",
	"server" => "localhost",
	"username" => "your_username",
	"password" => "your_password",
	"charset" => "utf8",

	// 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')"
// }