Posted: Thu Aug 24, 2006 12:05 am
I don't know. I've kind of been on auto-pilot lately. lol
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
class DB
{
private $queries;
private $results;
public function __construct ()
{
$this->queries = array();
$this->results = array();
}
/**
* adds the query to the query bin
* @param sql the query to be added
* @return int the index of the query, which will also be the index of the result.
*/
public function addQuery($sql)
{
$this->queries[] = $sql;
return max(array_keys($this->queries));
}
public function commit ()
{
foreach ($this->queries as $index => $query) {
$this->results[$index] = mysql_query($query);
}
}
public function getResult ($index = 0)
{
return $this->results[$index];
}
}Code: Select all
public function RegisterEntry($entry_type, $entry)
{
switch ($entry_type)
{
case 'error':
$this->errors[count($this->errors)] = $entry;
return count($this->errors)-1;
break;
case 'result':
$this->results[count($this->results)] = $entry;
return count($this->results)-1;
break;
case 'link':
$this->links[count($this->links)] = $entry;
return count($this->links)-1;
break;
default:
throw new Exception('Tried to register unknown or unallowed object!', 0x0f);
break;
}
}