Location: PHPKode > projects > O - OpenSource GroupWare > osgw/config/db_create.php
<?php
/**************************************************************************
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   @Authors:	Ryan Thompson(hide@address.com)
***************************************************************************/
//DEPRECATED??
include("../osgw/classes/class.config.php");
$cf = new setup;
$service['no_session'] = TRUE;
include("../config.inc.php");

$O->db->config = TRUE; //I don't think this needs to be here.
$cf->create_config_file($_POST);
include("../osgw/classes/class.osgw.php");
include("../osgw/classes/class.db_$db_type.php");

$O = new osgw();
$db = new db();

$db->host = $db_host;
$db->user = $db_user;
$db->password = $db_password;
$db->database = $db_name;

$db->db_connect();

include("db_tables.php");
include("db_data.php");
$lines = file($root_dir ."/services");
$i = 0;
foreach($lines as $line_num => $line)
{
	$location = rtrim($line);
	$data_file = $root_dir ."/". $location ."/config/db_install.php";
	
	include($data_file);
	

	
	$i++;
}

foreach($tables as $key => $value)
{
	
	$sql = $O->db->create_table($key, $value);
	$db->query($sql);
}



	foreach($record AS $table => $cells)
	{
		
		foreach($record[$table] AS $key => $value)
		{
			unset($cl);
			unset($dt);
			$sql = "INSERT INTO $table ";
			$cl = "(";
			$dt = "(";
			foreach($value AS $cell => $data)
			{
				$cl .= "$cell,";
				$dt .= "'$data',";
				
			}
			$sql .= substr($cl, 0, strlen($cl) - 1) .") VALUES ". substr($dt, 0, strlen($dt) - 1) .")";

			$db->query($sql);
			echo $db->error;
			
		//$O->db->create_query($table, $cell, $data);	
		}
	}



header("Location: root_setup.php");
Return current item: O - OpenSource GroupWare