Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Commit

Permalink
Bugs fixed in lib/class.dbh.php and lib/class.dlpacket.php.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFox committed Dec 6, 2010
1 parent 7178429 commit 073c9a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 9 additions & 7 deletions lib/class.dbh.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ function reloadById($id){
}

function save($item = null, $value = null){


#print "dbh.save $item && $value<br>\n";
$this->_dbhCheck();
#print "dbh.save '$item' = '$value'\n";
if($item && $value)

if($item !== null && $value !== null)
$this->set($item, $value);


Expand All @@ -80,11 +79,13 @@ function save($item = null, $value = null){
}
$sql .= " where id = '".$this->get('id')."' limit 1;";

#print "dbh.save '$sql'\n";
#print "dbh.save ".$this->dbh." '$sql'\n";
mysql_query($sql, $this->dbh);

$this->dataChanges = array();
}

#print "dbh.save ok $dataChangesLen<br>\n";
}

function get($item){
Expand All @@ -108,10 +109,11 @@ function _dbhConnect(){
}

function _dbhCheck(){
#print "dbh._dbhCheck<br>\n";
#print "dbh._dbhCheck ".$this->dbh."<br>\n";
if($this->dbh){
if(!@mysql_ping($this->dbh))
if(!mysql_ping($this->dbh))
$this->_dbhConnect();
#else print "dbh._dbhCheck ping ok<br>\n";
}
else{
if($this->dbhConfig['DB_HOST'] != '' && $this->dbhConfig['DB_NAME'] != '' && $this->dbhConfig['DB_USER'] != '' && $this->dbhConfig['DB_PASS'] != '')
Expand Down
3 changes: 2 additions & 1 deletion lib/class.dlpacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function __construct($dbHost, $dbName, $dbUser, $dbPass){
}

function loadFiles(){
#print "packet.loadFiles\n";
$this->_dbhCheck();

$res = mysql_query("select id from files where _packet = ".$this->data['id']." order by id;", $this->dbh);
while($row = mysql_fetch_assoc($res)){
#print "packet.loadFiles ".$row['id']."\n";
Expand Down

0 comments on commit 073c9a0

Please sign in to comment.