Skip to content

Commit d37e06f

Browse files
author
Craig Ballinger
committed
add sql table creation statement
1 parent 678edc3 commit d37e06f

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,24 @@ Install the library using composer
66
```
77
composer install syntactical/session
88
```
9-
Using a PDO MySQL session store
10-
```php
119

10+
##Using a PDO MySQL session store
11+
12+
Create the table:
13+
```sql
14+
CREATE TABLE `sessions` (
15+
`id` varchar(40) NOT NULL DEFAULT '0',
16+
`ip` int(10) NOT NULL DEFAULT '0',
17+
`user_agent` varchar(50) NOT NULL,
18+
`last_activity` int(10) unsigned NOT NULL DEFAULT '0',
19+
`data` text NOT NULL,
20+
PRIMARY KEY (`id`),
21+
KEY `last_activity` (`last_activity`)
22+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
23+
```
24+
25+
Bootstrap the library:
26+
```php
1227
$db = new PDO('mysql:host=your.db.host;dbname=db','username','password');
1328
$table = 'sessions';
1429
$storage = new MySQLStorage($db, $table);

0 commit comments

Comments
 (0)