read()) { if (($current != '..') && ($current != '.') && ($current != 'CVS')){ $file = $dir.$current; if(file_exists($file)) { require_once($file); } } } } ?>linkID = mysqli_connect($dbHost, $dbUsername, $dbPassword) or die(mysqli_error()); if ($this->linkID) { if (@mysqli_select_db($dbName, $this->linkID)) return $this->linkID; else { trigger_error(mysqli_error($this->linkID), NOTICE); trigger_error('Selecteren van database mislukt', ERROR); } } else { trigger_error(mysqli_error($this->linkID), NOTICE); trigger_error('Verbinden met MySQL server mislukt', ERROR); } } function query($sql) { $qStart = getMicrotime(); $this->queryResult = @mysqli_query($sql, $this->linkID); if ($this->queryResult) { $this->savedQueries[] = array($sql, sprintf('%.5f', getMicrotime() - $qStart)); ++$this->numQueries; return $this->queryResult; } else { $this->savedQueries[] = array($sql, 0); return false; } } function changeTable($fields, $whereClause, $table) { $valuelist = ''; $whereClause = stripslashes($whereClause); foreach ($fields as $key => $val) { if( $val == "NULL" ) { $valuelist .= '`'. $key . '` = ' . $val . ', '; } else { $valuelist .= '`'. $key . '` = \'' . $val . '\', '; } } if(substr($valuelist,-2)==', ') $valuelist = substr($valuelist,0,-2); //$valuelist = ereg_replace(', $', '', $valuelist); // Verwijder laatste ', ' if (!empty($whereClause)) $query = 'UPDATE ' . $table . ' SET ' . $valuelist . ' WHERE ' . $whereClause; else $query = 'INSERT INTO ' . $table . ' SET ' . $valuelist; #echo $query; return $this->query($query); } function fetch($queryID = NULL) { if (!isset($queryID) && @get_resource_type($this->queryResult) == 'mysql result') $queryID = $this->queryResult; return ($queryID) ? @mysqli_fetch_assoc($queryID) : false; } function fetchObject($queryID = NULL) { if (!isset($queryID) && @get_resource_type($this->queryResult) == 'mysql result') $queryID = $this->queryResult; return ($queryID) ? @mysqli_fetch_object($queryID) : false; } function fetchAll($queryID = NULL) { if (!isset($queryID) && @get_resource_type($this->queryResult) == 'mysql result') $queryID = $this->queryResult; if ($queryID) { while ($rec = @mysqli_fetch_assoc($queryID)) $recs[] = $rec; if(isset($recs) && is_array($recs)) { return $recs; } else { return false; } } return false; } function fetchRow($queryID = NULL) { if (!isset($queryID) && @get_resource_type($this->queryResult) == 'mysql result') $queryID = $this->queryResult; return ($queryID) ? @mysqli_fetch_row($queryID) : false; } function numRows($queryID = NULL) { if (!isset($queryID) && @get_resource_type($this->queryResult) == 'mysql result') $queryID = $this->queryResult; return ($queryID) ? @mysqli_num_rows($queryID) : false; } function affectedRows() { return ($this->linkID) ? @mysqli_affected_rows($this->linkID) : false; } function insertID() { return ($this->linkID) ? @mysqli_insert_id($this->linkID) : false; } function getNewID($table, $field) { $result = mysqli_query("SELECT MAX($field) AS MaxID FROM $table") or die(mysqli_error()); $data = mysqli_fetch_array($result) or die(mysqli_error()); $MaxID = $data['MaxID'] + 1; return $MaxID; } function getNumQueries() { return $this->numQueries; } function getSavedQueries() { return $this->savedQueries; } function freeResult($queryID = false) { return ($queryID) ? @mysqli_free_result($queryID) : false; } function escape($str) { if (function_exists('mysqli_real_escape_string')) { return mysqli_real_escape_string($str, $this->linkID); } else { return mysqli_escape_string($str); } } function close() { if ($this->linkID) { if ($this->queryResult) @mysqli_free_result($this->queryResult); return @mysqli_close($this->linkID); } else return false; } } // Create the database adapter object (and open/connect to/select db) $db = new dbLayer(CONF_MYSQL_SERVER, CONF_MYSQL_LOGIN, CONF_MYSQL_PASSWORD, CONF_MYSQL_DATABASE); ?>