Skip to content

Instantly share code, notes, and snippets.

@ExperimentGarden
Created February 24, 2010 23:39
Show Gist options
  • Save ExperimentGarden/314030 to your computer and use it in GitHub Desktop.
Save ExperimentGarden/314030 to your computer and use it in GitHub Desktop.
<?php
//Set up the tables that we will store data in.
//If these tables already exist from a previous installation,
//they will not be changed in any way.
$unused = mysql_query('create table if not exists members (id int not null auto_increment, primary key (id), name text, passwordHash text, email text)')
or die("Unable to install the member table!");
//If the options are messed up you can uncomment the following line to restore
//everything to its default.
//$unused = mysql_query('drop table if exists global_options') or die("Failed to install correctly!");
//Set up the option table if needed.
$unused = mysql_query('create table if not exists options (optionName text, optionInt int, optionText text)')
or die("Failed to install correctly!");
//Set up each option. Currently there is only one option which indicates that
//the database is installed correctly.
$unused = mysql_query("insert into options set optionName='installed', optionInt=1, optionText='This is a flag for installation.'")
or die("Failed to install correctly!");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment