config.php update

remotes/origin/database-api-implementation
Dorian HODIN 2 years ago committed by felixmielcarek
parent 849cf586ad
commit 48f60ce0c3

@ -1,18 +0,0 @@
CREATE DATABASE IF NOT EXISTS positiondaflmusic;
CREATE USER $(USER)@'%' IDENTIFIED BY $(PASSWORD);
GRANT ALL PRIVILEGES ON * . * TO $(USER)@'%';
FLUSH PRIVILEGES;
CREATE TABLE gps (
id varchar(30) PRIMARY KEY,
latitude double NOT NULL,
longitude double NOT NULL,
idMusic varchar(100) NOT NULL,
dateLog datetime NOT NULL
);

@ -3,18 +3,18 @@
function connection(): bool|int|mysqli
{
$username = $_ENV["USER"]; //Get the username
$host = $_ENV["HOST"]; //Get the url of the database
$username = $_ENV["USER"]; //Get the username
$host = $_ENV["HOST"]; //Get the url of the database
$password = $_ENV["PASSWORD"]; //Get the password for the user selected
$db_name = $_ENV["DATABASE"]; //Get the name of the database
$db_name = $_ENV["DATABASE"]; //Get the name of the database
try { //Try to connect to the database
try { //Try to connect to the database
return mysqli_connect($host, $username, $password,$db_name); //Connecting to database
return mysqli_connect($host, $username, $password,$db_name); //Connecting to database
}catch (mysqli_sql_exception) { //If the connection failed
}catch (mysqli_sql_exception) { //If the connection failed
return -1; //Send a return code as -1, so insertAndMakeListUser.php can know if the connection is successful
return -1; //Send a return code as -1, so insertAndMakeListUser.php can know if the connection is successful
}
}

Loading…
Cancel
Save