From 1f9d6bfda478dcf262ce3f35c5edbbb035944b65 Mon Sep 17 00:00:00 2001 From: Jamie Matthews Date: Tue, 25 Jan 2011 00:01:15 +0000 Subject: Add MySQL-specific connection example in README --- README.markdown | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'README.markdown') diff --git a/README.markdown b/README.markdown index 7c06bc1..709303e 100644 --- a/README.markdown +++ b/README.markdown @@ -58,10 +58,17 @@ First, `require` the Idiorm source file: require_once 'idiorm.php'; -Then, pass a *Data Source Name* connection string to the `configure` method of the ORM class. This is used by PDO to connect to your database. For more information, see the [PDO documentation](http://uk2.php.net/manual/en/pdo.construct.php). Particularly, if you need to pass a username and password to your database driver, use the `username` and `password` configuration options. See "Configuration" section below. - +Then, pass a *Data Source Name* connection string to the `configure` method of the ORM class. This is used by PDO to connect to your database. For more information, see the [PDO documentation](http://uk2.php.net/manual/en/pdo.construct.php). ORM::configure('sqlite:./example.db'); +You may also need to pass a username and password to your database driver, using the `username` and `password` configuration options. For example, if you are using MySQL: + + ORM::configure('mysql:host=localhost;dbname=my_database'); + ORM::configure('username', 'database_user'); + ORM::configure('password', 'top_secret'); + +Also see "Configuration" section below. + ### Querying ### Idiorm provides a [*fluent interface*](http://en.wikipedia.org/wiki/Fluent_interface) to enable simple queries to be built without writing a single character of SQL. If you've used [jQuery](http://jquery.com) at all, you'll be familiar with the concept of a fluent interface. It just means that you can *chain* method calls together, one after another. This can make your code more readable, as the method calls strung together in order can start to look a bit like a sentence. -- cgit v1.2.3