Medoo Introduction
Medoo is an ultra-lightweight PHP SQL database framework developed by Li Yan, founder of the social networking site Catfan and the Open source project Qatrix. Provides a simple, easy-to-learn, flexible API that improves the efficiency and performance of developing Web applications, and is less than 8KB in volume.
Characteristics
Lightweight, with only one file
Easy to learn, data structure at a glance
supports multiple SQL syntax and supports complex query conditions
Support multiple databases, including MySQL, MSSQL, SQLite, etc.
Security to prevent SQL injection
Free, based on the MIT Protocol
Sample code
Increase
Copy the Code code as follows:
$database = new Medoo ("My_database");
$last _user_id = $database->insert ("Account", [
"User_name" = "foo",
"Email" = "foo@bar.com",
"Age" = 25,
"Lang" = [
"EN",
"FR",
"JP",
"CN"
]
] );
Delete
Copy the Code code as follows:
$database = new Medoo ("My_database");
$database->delete ("Account", [
"and" = [
"Type" = "Business"
"AGE[<]" = 18
]
]);
Modify
Copy the Code code as follows:
$database = new Medoo ("My_database");
$database->update ("Account", [
"Type" = "User",
All-age plus one
"age[+]" = 1,
All level Subtract 5
"level[-]" = 5,
"Lang" = [
"EN",
"FR",
"JP",
"CN",
"De"
]
], [
"USER_ID[<]" = 1000
] );
Inquire
Copy the Code code as follows:
$database = new Medoo ("My_database");
$datas = $database->select ("Account", [
"User_name",
"Email"
], [
"USER_ID[>]" = 100
] );
$datas = Array (
[0] = = Array (
"User_name" = "foo",
"Email" = "foo@bar.com"
// ),
[1] = = Array (
"User_name" = "cat",
"Email" = "cat@dog.com"
// )
// )
foreach ($datas as $data) {
echo "user_name:". $data ["user_name"]. "-Email:". $data ["Email"]. "
";
}
Select All Columns
$datas = $database->select ("Account", "*");
Select a column
$datas = $database->select ("account", "user_name");
$datas = Array (
[0] = "foo",
[1] = "Cat"
// )
http://www.bkjia.com/PHPjc/824650.html www.bkjia.com true http://www.bkjia.com/PHPjc/824650.html techarticle Medoo Introduction Medoo is an ultra-lightweight PHP SQL database framework developed by Li Yan, founder of the social networking site Catfan and open source project Qatrix. Provide a simple, easy to learn, flexible API, mention ...