From 936ebf61f5e296c31f7b30fdec1e8b3e74895640 Mon Sep 17 00:00:00 2001 From: Christian Weber Date: Wed, 26 Sep 2007 16:20:25 +0000 Subject: Make sure singleton exists. new non-table calls store new settings --- it_dbi.class | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'it_dbi.class') diff --git a/it_dbi.class b/it_dbi.class index 09557de..60619a4 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -71,6 +71,9 @@ function it_dbi($p = array(), $query = null) if ($p['table']) # Standard use: create a table object { + if (!isset($GLOBALS['it_dbi'])) + new it_dbi; + $this->_p += $this->_get_field_info(); # Get $this->_fields and p[keyfield, autoincrement, randomid] if (is_array($query)) @@ -78,7 +81,7 @@ function it_dbi($p = array(), $query = null) elseif (isset($query)) $this->read($query); } - elseif (!$GLOBALS['it_dbi']) # Special use w/o table: create singleton to store settings + else $GLOBALS['it_dbi'] =& $this; } -- cgit v1.2.3