Sample config, setup and .gitignore.
Added .gitignore to avoid credentials, added sample credentials. Added setup to create table.
This commit is contained in:
parent
866bb68c88
commit
25592475f0
|
@ -0,0 +1 @@
|
|||
mysql_credentials.php
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
return array(
|
||||
"servername" => "localhost",
|
||||
"username" => "username_goes_here",
|
||||
"password" => "password_goes_here",
|
||||
"database" => "database_name_goes_here"
|
||||
);
|
||||
?>
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
// MySQL credentials
|
||||
$mysql = require('mysql_credentials.php');
|
||||
|
||||
$conn = new mysqli($mysql["servername"], $mysql["username"], $mysql["password"], $mysql["database"]);
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
$query = "create table data(
|
||||
id int(10) primary key,
|
||||
a int(8) default 0,
|
||||
b int(8) default 0,
|
||||
c int(8) default 0,
|
||||
d int(8) default 0,
|
||||
e int(8) default 0,
|
||||
f int(8) default 0,
|
||||
g int(8) default 0,
|
||||
h int(8) default 0,
|
||||
i int(8) default 0,
|
||||
j int(8) default 0,
|
||||
k int(8) default 0,
|
||||
l int(8) default 0,
|
||||
m int(8) default 0,
|
||||
n int(8) default 0,
|
||||
o int(8) default 0,
|
||||
p int(8) default 0,
|
||||
q int(8) default 0,
|
||||
r int(8) default 0,
|
||||
s int(8) default 0,
|
||||
t int(8) default 0,
|
||||
u int(8) default 0,
|
||||
v int(8) default 0,
|
||||
w int(8) default 0,
|
||||
x int(8) default 0,
|
||||
y int(8) default 0,
|
||||
z int(8) default 0
|
||||
);";
|
||||
if ($conn->query($query) === true) {
|
||||
echo "Succesfully created table";
|
||||
}
|
||||
else {
|
||||
echo "Error creating tables";
|
||||
}
|
||||
$conn->close();
|
||||
?>
|
Loading…
Reference in New Issue