query
执行sql语句
query($query)
query [string]
The SQL 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);