/extremedating/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/extremedating/trunk

« back to all changes in this revision

Viewing changes to php/db.php

  • Committer: Gustav Hatvigsson
  • Date: 2013-04-13 11:53:22 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20130413115322-3ytf0o1l3jiyhm08
Storted work on the database.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/*
 
3
    ExtremeDating - a Hackathon 2013 project.
 
4
    Copyright (C) 2013 Gustav Hartvigsson <gustav.hartvigsson@gmail.com>
 
5
    Copyright (C) 2013 Daniel Johansson <maila@danieljohansson.nu>
 
6
 
 
7
 
 
8
    This program is free software: you can redistribute it and/or modify
 
9
    it under the terms of the GNU Affero General Public License as
 
10
    published by the Free Software Foundation, either version 3 of the
 
11
    License, or (at your option) any later version.
 
12
 
 
13
    This program is distributed in the hope that it will be useful,
 
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
    GNU Affero General Public License for more details.
 
17
 
 
18
    You should have received a copy of the GNU Affero General Public License
 
19
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
 
 
21
 */
 
22
$db = new PDO("sqlite:./database.db");
 
23
 
 
24
$db->setAttribute(PDO::ATTR_ERRMODE, 
 
25
                          PDO::ERRMODE_EXCEPTION);
 
26
 
 
27
/*
 
28
Database design:
 
29
Users(_loginName_, shadow, firstName, surname, city, eMail);
 
30
Resturants(_id_, name, city, phoneNumber, theme);
 
31
# Theme is if it is, say, a pizzeria or a french resturant or something.
 
32
Interests(_interest_);
 
33
FoodType(_foodType_);
 
34
UserInterests(-loginName-, -interest-, -foodType-);
 
35
*/
 
36
 
 
37
$db->exec("
 
38
  CREATE TABLE IF NOT EXISTS Users(
 
39
  loginName varchar(64) NOT NULL,
 
40
  shadow varchar(64) NOT NULL,
 
41
  firstName varchar(64) NOT NULL,
 
42
  surname varchar(64) NOT NULL,
 
43
  city varchar(64) NOT NULL,
 
44
  eMail varchar(64) NOT NULL,
 
45
  UNIQUE (loginName));
 
46
");
 
47
 
 
48
?>