Get Started

Medoo 1.4

Where Syntax

Query

Fetch

Transaction

Advanced

PDO object

Debug

Information

version: 1.4.5

query

Execute customized raw query

query($query)
Return: [object] The PDOStatement object.
Medoo is handled all queries with SQL-92 standard. You should keep in mind about the quotation mark in the query, or use prepared statement to prevent SQL injection.
$database->query("CREATE TABLE table (
	c1 INT STORAGE DISK,
	c2 INT STORAGE MEMORY
) ENGINE NDB;");

$data = $database->query("SELECT email FROM account")->fetchAll();
print_r($data);

// Prepared statement
// Medoo will auto-detect the data type for input parameters
$data = $database->query(
	"SELECT * FROM account WHERE user_name = :user_name AND age = :age", [
		":user_name" => "John Smite",
		":age" => 20
	]
)->fetchAll();

print_r($data);