Medoo

开始

更新日志

Where 语句

查询

聚合

Fetch

事务

原生SQL查询

Raw object

PDO object

Debug

数据库信息

query

执行sql语句

query($query)
Return: [object] The PDOStatement object.
此方法用于使用复杂的SQL语句,SQL注入问题请参考quote方法
$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);