diff --git a/blomzt/main.php b/blomzt/main.php index 159398d..f31d2f6 100644 --- a/blomzt/main.php +++ b/blomzt/main.php @@ -4,11 +4,16 @@ $config = parse_ini_file('config.ini'); $conn = mysqli_connect($config['db_host'], $config['db_user'], $config['db_password'], 'blomzt'); -if ($conn->connect_error) { - die("Connection failed: " . $conn->connect_error); +if (mysqli_connect_errno()) { + die("Connection failed: " . mysqli_connect_error()); } - +if (!TableExists($config['db_table'], $conn)) { + $sql = 'CREATE TABLE ' . $config['db_table'] . ' ( + id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, location Point NOT NULL, url VARCHAR(65), date_added TIMESTAMP) + '; + mysqli_query($conn, $sql); +} ?> @@ -19,6 +24,17 @@ if ($conn->connect_error) {