Location: PHPKode > projects > Simple E-document > simple_e_document_v_1_3/sql.php
<?php

include "settings.php";

$connect = mysql_connect($databasehost, $databaseuname, $databasepass, $databasename);

$db=mysql_select_db($databasename);
if(!$db) echo "could not connect to database. Check settings.php";

$sql = 'CREATE TABLE `edocphp_main_in` ('
  . '`id` int(11) NOT NULL AUTO_INCREMENT,'
  . '`Document_U_No` varchar(255) NOT NULL,'
 . ' `Document_Type` varchar(255) NOT NULL,'
 . ' `Document_From` varchar(255) NOT NULL,'
 . ' `Document_From2` varchar(255) NOT NULL,'
 . ' `Document_Subject` varchar(255) NOT NULL,'
 . ' `Document_To1` varchar(255) NOT NULL,'
 . ' `Document_To2` varchar(255) NOT NULL,'
 . ' `Document_To3` varchar(255) NOT NULL,'
 . ' `Document_To4` varchar(255) NOT NULL,'
 . ' `Document_To5` text NOT NULL,'
 . ' `Document_Issued_Date` varchar(255) NOT NULL,'
 . ' `Document_Received_Date` varchar(255) NOT NULL,'
 . ' `Document_Stored_Date` varchar(255) NOT NULL,'
 . ' `Document_Physical_File` varchar(255) NOT NULL,'
 . ' `Document_Path` varchar(255) NOT NULL,'
 . ' `Document_Details` text NOT NULL,'
 . ' `Document_Actions_Needed` text NOT NULL,'
 . ' `Document_Actions_Performed` text NOT NULL,'
 . ' `Document_All_Actions_Completed` varchar(255) NOT NULL,'
 . ' `Document_Comments` text NOT NULL,'
 . ' `Document_Removed` varchar(255) NOT NULL,'
 . ' `Document_Removed_Reason` text NOT NULL,'
 . ' `Document_Removed_Date` varchar(255) NOT NULL,'
 . ' `Document_Related` text NOT NULL,'
 . ' PRIMARY KEY  (`id`),'
 . ' UNIQUE KEY `Document_U_No` (`Document_U_No`)'
. ') ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;';



$sql1 = 'CREATE TABLE `edocphp_main_out` ('
  . '`id` int(11) NOT NULL AUTO_INCREMENT,'
  . '`Document_U_No` varchar(255) NOT NULL,'
  . '`Document_Type` varchar(255) NOT NULL,'
  . '`Document_From` varchar(255) NOT NULL,'
  . '`Document_From2` varchar(255) NOT NULL,'
  . '`Document_Subject` varchar(255) NOT NULL,'
  . '`Document_To1` varchar(255) NOT NULL,'
  . '`Document_To2` varchar(255) NOT NULL,'
  . '`Document_To3` varchar(255) NOT NULL,'
  . '`Document_To4` varchar(255) NOT NULL,'
  . '`Document_To5` text NOT NULL,'
  . '`Document_Issued_Date` varchar(255) NOT NULL,'
  . '`Document_Sent_Date` varchar(255) NOT NULL,'
  . '`Document_Stored_Date` varchar(255) NOT NULL,'
  . '`Document_Physical_File` varchar(255) NOT NULL,'
  . '`Document_Path` varchar(255) NOT NULL,'
  . '`Document_Details` text NOT NULL,'
  . '`Document_Actions_Needed` text NOT NULL,'
  . '`Document_Actions_Performed` text NOT NULL,'
  . '`Document_All_Actions_Completed` varchar(255) NOT NULL,'
  . '`Document_Comments` text NOT NULL,'
  . '`Document_Removed` varchar(255) NOT NULL,'
  . '`Document_Removed_Reason` text NOT NULL,'
  . '`Document_Removed_Date` varchar(255) NOT NULL,'
  . '`Document_Related` text NOT NULL,'
  . 'PRIMARY KEY  (`id`),'
  . 'UNIQUE KEY `Document_U_No` (`Document_U_No`)'
. ') ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;';



$sql2 = 'CREATE TABLE `edocphp_users` ('
  . '`id` int(11) NOT NULL AUTO_INCREMENT,'
  . '`username` varchar(255) NOT NULL,'
  . '`password` varchar(255) NOT NULL,'
  . '`date_created` varchar(255) NOT NULL,'
  . '`is_admin` varchar(255) NOT NULL default "",'
  . '`is_s_admin` varchar(255) NOT NULL default "",'
  . 'PRIMARY KEY  (`id`),'
  . 'UNIQUE KEY `username` (`username`)'
. ') ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;';



$sql3 = 'INSERT INTO `edocphp_users` (`id`, `username`, `password`, `date_created`, `is_admin`, `is_s_admin`) VALUES '
. '(1, "superadmin", "363ab055963fb24eff2cfc02437ec228", "1168293309", "", "1");';

$resultq = mysql_query($sql) or die(mysql_error());
$resultq = mysql_query($sql1) or die(mysql_error());
$resultq = mysql_query($sql2) or die(mysql_error());
$resultq = mysql_query($sql3) or die(mysql_error());

if ($resultq)
die('Database Created!. Please remove this file from your web server.');
?>
Return current item: Simple E-document