Location: PHPKode > projects > Run > Run-0.8.0.2/Run-0.8.0.2/Install/CleanInstall08.php
<?php

include("../system/configuration.php");

$connect = mysql_connect($mysqlservername, $mysqlusername, $mysqlpassword) or die(mysql_error());
mysql_select_db($mysqldbname, $connect) or die(mysql_error());


//create table Runners where data about runners is stored
$createRunnersQuery = "create table $mysqlTableRunners (
ID int not null auto_increment primary key,
RunnerID varchar(30) not null,
Password varchar(40) not null,
FirstName varchar(30) not null,
LastName varchar(30) not null,
DateOfBirth date not null,
Gender char(1) not null,
MemberSince date not null,
GroupID varchar(30),
Notes text,
Active char(1) not null,
ViewMode varchar(14),
Language varchar(2),
Measurements varchar(10))";
mysql_query($createRunnersQuery) or die(mysql_error());


//create table RunningLogs where data about runs is stored
$createRunningLogsQuery = "create table $mysqlTableRunningLogs (
ID int not null auto_increment primary key,
RunnerID varchar(30) not null,
Date date not null,
TimeOfDay varchar(10) not null,
Time time not null,
Distance decimal(3,1) unsigned not null,
DistanceUnit char(2),
RunType varchar(15) not null,
Surface varchar(15) not null,
Terrain varchar(15) not null,
Weather varchar(15) not null,
Temperature tinyint(2),
TemperatureUnit char(2),
AHR tinyint(3) unsigned,
Weight tinyint(3) unsigned,
WeightUnit char(2),
Shoes varchar(50),
Feeling varchar(15) not null,
Notes text
)";
mysql_query($createRunningLogsQuery) or die(mysql_error());


//create table Shoes where data about runner's shoes is stored
$createShoesQuery = "create table $mysqltableshoes (
ID int not null auto_increment primary key,
RunnerID varchar(30) not null,
ShoeName varchar(30) not null,
ShoeModel varchar(30) not null,
ShoeBrand varchar(30) not null,
ShoeSize decimal(3,1) unsigned not null,
ShoeFirstRunDate date,
ShoeLastRunDate date,
ShoeNotes text,
ShoeRetired char(1) not null
)";
mysql_query($createShoesQuery) or die(mysql_error());


//add user Administrator to the Runners with pass admin, activity set to Y and language to en
$adminQuery = mysql_query("insert into $mysqlTableRunners (RunnerID, Password, Active, Language) values ('Administrator', sha1('admin'), 'Y', 'en')");


echo "Run tables were successfully created.<br>Log in with administrator's account to create runners.<br>You can now remove this file.";

?>
Return current item: Run