From 3256717165436e4e90bc5ca764babf1bd8d97f0a Mon Sep 17 00:00:00 2001 From: root Date: Wed, 24 Sep 2014 18:55:57 +0200 Subject: improvemend --- bootstrap/class/mysql.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'bootstrap/class/mysql.php') 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("

".$e->getMessage()."

", '500 Server Failure', false, '

Failed to open database connection.

'); } - if ( $this->db->connect_errno() ){ + if ( $this->db->connect_errno ){ failure("

Can't connect to the database. MySQL gave this error code: " . $this->db->connect_errno . "

", '500 Server Failure', false, '

Connection to MySQL server failed.

'); } @@ -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("

There was a problem during bootstrapping the database schema. " . $this->db->error . "

", '500 Server Failure', false, "

CREATE TABLE FAILED

"); } -- cgit v1.2.3