Get Started

Medoo 1.2

Where Syntax

Query

Fetch

Transaction

Advanced

PDO object

Debug

Information

version: 1.2.1

Upgrading Medoo 1.1 to Medoo 1.2

Medoo 1.2 have a lot of incompatible changes with older version. If you want to upgrade Medoo to this version, please read the following guide.

Installation

Medoo is now dropped support for PHP 5.1. The minimize environment is now required PHP 5.4+.

Initialization

Medoo is now using namespace and PSR standard. You have to add use Medoo\Medoo; in front of the initialization, and change new medoo() to new Medoo()

Old version
require 'vendor/autoload.php';

$database = new medoo([
	'database_type' => 'mysql',
	'database_name' => 'name',
	'server' => 'localhost',
	'username' => 'your_username',
	'password' => 'your_password',
]);
Medoo 1.2
require 'vendor/autoload.php';

use Medoo\Medoo;

$database = new Medoo([
	'database_type' => 'mysql',
	'database_name' => 'name',
	'server' => 'localhost',
	'username' => 'your_username',
	'password' => 'your_password',
]);

Last insert ID

For old version, the API insert() will return the last inserted row ID by default. But for Medoo 1.2, you have to call the new API id() alone to get the ID.

Old version
$account_id = $database->insert("account", [
	"user_name" => "foo",
	"email" => "foo@bar.com",
	"age" => 25
]);
Medoo 1.2
$database->insert("account", [
	"user_name" => "foo",
	"email" => "foo@bar.com",
	"age" => 25
]);

$account_id = $database->id();

New API

Medoo updated all API method name to camel case, and simplified the name.

Old version
$database->insert("account", [
	"user_name" => "foo",
	"email" => "foo@bar.com",
	"age" => 25
]);

$database->last_query();
Medoo 1.2
$database->insert("account", [
	"user_name" => "foo",
	"email" => "foo@bar.com",
	"age" => 25
]);

$database->last();