diff options
Diffstat (limited to 'bootstrap/class/mysql.php')
| -rw-r--r-- | bootstrap/class/mysql.php | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/bootstrap/class/mysql.php b/bootstrap/class/mysql.php index 0140994..8d75538 100644 --- a/bootstrap/class/mysql.php +++ b/bootstrap/class/mysql.php @@ -15,7 +15,7 @@ class db { failure("<p>".$e->getMessage()."</p>", '500 Server Failure', false, '<h1>Failed to open database connection.</h1>'); } - if ( $this->db->connect_errno() ){ + if ( $this->db->connect_errno ){ failure("<p>Can't connect to the database. MySQL gave this error code: " . $this->db->connect_errno . "</p>", '500 Server Failure', false, '<h1>Connection to MySQL server failed.</h1>'); } @@ -46,7 +46,7 @@ class db { if ( ! $this->check() ) return false; - return $this->db->query($sql); + return $this->db->query($string); } # does multiple queries WITHOUT output (INSERT, UPDATE, DELETE... ) @@ -63,7 +63,7 @@ class db { break; if ( ! $this->db->next_result() ){ if ( $this->db->error != "" ){ - $res->free(); + //$result->free(); return false; } } @@ -117,8 +117,8 @@ class db { name VARCHAR(70), UNIQUE(name), password VARCHAR(70), UNIQUE(password), email VARCHAR(70), UNIQUE(email), - register INTEGER, - ENGINE=InnoDB;'; + register INTEGER + ) ENGINE=InnoDB;'; $banned_user_table = 'CREATE TABLE IF NOT EXISTS ' . DBPREFIX . 'banned_user @@ -131,7 +131,19 @@ class db { ) ENGINE=InnoDB;'; - if ( ! $this->execMultipleQueries('BEGIN; '. $user_table . ' ' . $banned_user_table . ' END;') ) + $jg_table = + 'CREATE TABLE IF NOT EXISTS ' . DBPREFIX . 'member + ( member_id INTEGER AUTO_INCREMENT NOT NULL, PRIMARY KEY(member_id), + name varchar(70), UNIQUE(name), + adresse TEXT, + telefonnummer TEXT, + handynummer TEXT, + email varchar(70), UNIQUE(email), + geburtstag TEXT + ) + ENGINE=InnoDB;'; + + if ( ! $this->execMultipleQueries('BEGIN; '. $user_table . ' ' . $banned_user_table . ' ' . $jg_table . ' COMMIT;') ) failure("<p>There was a problem during bootstrapping the database schema. " . $this->db->error . "</p>", '500 Server Failure', false, "<h1>CREATE TABLE FAILED</h1>"); } |
