forked from edfilo/crows
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdbcreate.php
More file actions
13 lines (10 loc) · 871 Bytes
/
dbcreate.php
File metadata and controls
13 lines (10 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
require('config.php');
/* Simple DB creation script. Tested with MySQL and sqlite backends. */
$dbhandle = new PDO($database_dsn, $database_user, $database_password);
/* Ugh. It's AUTOINCREMENT with sqlite3 and AUTO_INCREMENT with mysql. One of these should work... */
$dbhandle->exec("CREATE TABLE IF NOT EXISTS reports (`id` INTEGER PRIMARY KEY AUTO_INCREMENT, `date` DATETIME, `title` VARCHAR(255), name VARCHAR(255), location VARCHAR(255), lat DOUBLE, `long` DOUBLE, report TEXT, link VARCHAR(255), photo VARCHAR(255), embed VARCHAR(255))")
or
$dbhandle->exec("CREATE TABLE IF NOT EXISTS reports (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `date` DATETIME, `title` VARCHAR(255), name VARCHAR(255), location VARCHAR(255), lat DOUBLE, `long` DOUBLE, report TEXT, link VARCHAR(255), photo VARCHAR(255), embed VARCHAR(255))")
or
print_r($dbhandle->errorInfo());