rest-based-web-service / install.php
install.php
Raw
<?php

include("config.php"); 
// Create connection
$db = new mysqli('studentmysql.miun.se', 'alza2100', 'nZVgHJsAnn', 'alza2100');

// Check connection
if($db->connect_error > 0){
    die('Connection failed: ' . $db->connect_error);
}


// SQL query
$sql = "
CREATE TABLE course(
    id INT(11) PRIMARY KEY AUTO_INCREMENT,
    title VARCHAR(128) NOT NULL,
    code VARCHAR(128) NOT NULL,
    progression TEXT NOT NULL,
    syllabus TEXT NOT NULL
);
";

if($db->multi_query($sql)){
    echo "the tabel has been installed";
} else {
    echo " error when installing the tabel";
}

?>