Get Started

Where Syntax

Query

Transaction

Advanced

PDO object

Debug

Information

version: 1.1.3

debug

Output the generated SQL without execute it.

debug()
Return: Medoo object with debug mode enabled
This feature will output the generated SQL query automatically without using echo or other function. Please keep removed it when you finish debugging. And check the following code will be executed normally if this query do not be executed.
$database->debug()->select("bccount", [
	"user_name",
	"email"
], [
	"user_id[<]" => 20
]);

// Will output:
// SELECT "user_name","email" FROM "bccount" WHERE "user_id" < 20

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

// Will output the generated query
$post_id = $database->debug()->get("post", "post_id", ["user_name" => "foo"]);

// Be careful, this query will be executed.
$database->update("account", [
	"level[+]" => 5,
	"post" => $post_id
], [
	"user_name" => "foo"
]);