Subversion-Projekte lars-tiefland.inventar

Revision

Revision 7 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
12 lars 1
<?php
6 lars 2
	//$Id: connect.php 12 2008-05-10 22:41:46Z lars $
7 lars 3
 
2 lars 4
	/**
7 lars 5
	 * @package	Inventar Datenbank
6
	 * @author Lars Tiefland <ltiefland@gmail.com>
7
	 * @copyright 2008
2 lars 8
	 **/
7 lars 9
 
2 lars 10
	require_once("Config.php");
11
	require "MDB2.php";
12
 
13
	$cfg=new Config();
14
	$db_conf=$cfg->parseConfig("include/config.xml","XML",array("name"=>"db"));
15
	$db_conf=$db_conf->toArray();
16
	foreach ($db_conf["root"]["db"] as $k => $v)
17
	{
18
		$$k=$v;
19
	}
20
	$dsn="$db_type://$db_user:$db_pass@$db_host/$db_name";
4 lars 21
	$GLOBALS["db"]=MDB2::connect($dsn,array());
22
	if ( $res=(true == MDB2::isError($GLOBALS["db"])))
2 lars 23
	{
24
		$smarty->assign("meld", "Es ist ein Fehler aufgetreten!");
25
		$smarty->assign("db_meld",$db->getMessage());
26
		$smarty->assign("error",true);
27
		$smarty->display("meld.tpl");
28
		exit;
29
	}
4 lars 30
	$r2=$GLOBALS["db"]->query("SET CHARACTER SET latin1");
31
	$GLOBALS["db"]->setFetchMode(MDB2_FETCHMODE_ASSOC);
2 lars 32
?>