summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Matthews <[email protected]>2011-01-25 00:01:15 +0000
committerJamie Matthews <[email protected]>2011-01-25 00:01:15 +0000
commit1f9d6bfda478dcf262ce3f35c5edbbb035944b65 (patch)
tree31bcc0d846a2951366b2fe7bce36f16b66a9ea1f
parent7ac073125744d9ca7273488f48a1d7261c42c503 (diff)
Add MySQL-specific connection example in README
-rw-r--r--README.markdown11
1 files changed, 9 insertions, 2 deletions
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.