Skip to content

Commit

Permalink
add sql table creation statement
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Ballinger committed Dec 2, 2015
1 parent 678edc3 commit d37e06f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,24 @@ Install the library using composer
```
composer install syntactical/session
```
Using a PDO MySQL session store
```php

##Using a PDO MySQL session store

Create the table:
```sql
CREATE TABLE `sessions` (
`id` varchar(40) NOT NULL DEFAULT '0',
`ip` int(10) NOT NULL DEFAULT '0',
`user_agent` varchar(50) NOT NULL,
`last_activity` int(10) unsigned NOT NULL DEFAULT '0',
`data` text NOT NULL,
PRIMARY KEY (`id`),
KEY `last_activity` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
```

Bootstrap the library:
```php
$db = new PDO('mysql:host=your.db.host;dbname=db','username','password');
$table = 'sessions';
$storage = new MySQLStorage($db, $table);
Expand Down

0 comments on commit d37e06f

Please sign in to comment.