| | |
| | | private $dbUser = ''; // database authorized user |
| | | private $dbPass = ''; // user's password |
| | | private $dbCharset = ''; // what charset comes and goes to mysql: utf8 / latin1 |
| | | private $dbNewLink = false; // Return a new linkID when connect is called again |
| | | private $dbClientFlags = 0; // MySQL Client falgs |
| | | private $linkId = 0; // last result of mysql_connect() |
| | | private $queryId = 0; // last result of mysql_query() |
| | | private $record = array(); // last record fetched |
| | |
| | | $this->dbUser = $conf['db_user']; |
| | | $this->dbPass = $conf['db_password']; |
| | | $this->dbCharset = $conf['db_charset']; |
| | | $this->dbNewLink = $conf['db_new_link']; |
| | | $this->dbClientFlags = $conf['db_client_flags']; |
| | | //$this->connect(); |
| | | } |
| | | |
| | |
| | | public function connect() |
| | | { |
| | | if($this->linkId == 0){ |
| | | $this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass); |
| | | $this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbNewLink, $this->dbClientFlags); |
| | | if(!$this->linkId){ |
| | | $this->updateError('DB::connect()<br />mysql_connect'); |
| | | return false; |
| | |
| | | } |
| | | |
| | | //** Updates a record and saves the changes into the datalog |
| | | public function datalogUpdate($tablename, $update_data, $index_field, $index_value) { |
| | | public function datalogUpdate($tablename, $update_data, $index_field, $index_value, $force_update = false) { |
| | | global $app; |
| | | |
| | | $old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'"); |
| | | if($force_update == true) { |
| | | $old_rec = array(); |
| | | } else { |
| | | $old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'"); |
| | | } |
| | | $this->query("UPDATE $tablename SET $update_data WHERE $index_field = '$index_value'"); |
| | | $new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'"); |
| | | $this->datalogSave($tablename, 'UPDATE', $index_field, $index_value, $old_rec, $new_rec); |