final function __construct() { # not to be overidden!!
# connection initialised during the lifetime of the object instance
$this->$connection = odbc_connect("owl", "", "");
}
final function __destruct() { # not to be overidden!!
# close $connection resource upon estruction of the object instance (the page handles this).
# mop up database connections stopping memory leaks and zombie threads. Hopefully!
odbc_close($this->$connection);
unset($this->$connection);
}
protected function dbQuery($query, $select) {
# $query = SQL Statement
# $select = boolean (true if SQL is SELECT statement, false if SQL is not SELECT statement)
# performs SQL query on $connection
# the result is multiple lines). It is then up to the initaiting script to use the
# data passed back in the array
$result = odbc_exec($this->$connection, $query); # Query database
$s=0;
while(odbc_fetch_row($result)) {
$s++;
}
if ($select) {
if ($s > 1) { # check no of rows returned action to correct array type.
$final = array();
$i = 0;
while($i<=$s) {
$j=1;
while($j<=odbc_num_fields($result)) {
$final[$i][$j] = odbc_result($result, $j); # 3D Array
$j++;
}
$i++;
}
} else {
$final = odbc_fetch_row($result); # Array
}
}
return $final;
}
----
Manual Page -- http://www.php.net/manual/en/ref.odbc.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34351
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34351&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34351&report=yes