aboutsummaryrefslogtreecommitdiffstats
path: root/include/dba.php
diff options
context:
space:
mode:
authorolivierm <olivier@migeot.org>2011-03-08 14:39:26 +0100
committerolivierm <olivier@migeot.org>2011-03-08 14:39:26 +0100
commit25c674b73a5ec39a9826906aed3e35e77d72e392 (patch)
treedc17e0d8f5dc899ccfa9e0239fe7623c43a95d49 /include/dba.php
parent07ebc15612807512422ba84060914c5c4c853102 (diff)
parentc248b28f922603ec135fea903a9ec3f0ef63c935 (diff)
downloadvolse-hubzilla-25c674b73a5ec39a9826906aed3e35e77d72e392.tar.gz
volse-hubzilla-25c674b73a5ec39a9826906aed3e35e77d72e392.tar.bz2
volse-hubzilla-25c674b73a5ec39a9826906aed3e35e77d72e392.zip
Merge remote branch 'mike/master'
Diffstat (limited to 'include/dba.php')
-rw-r--r--include/dba.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/dba.php b/include/dba.php
index b05a1cabf..d75ed560a 100644
--- a/include/dba.php
+++ b/include/dba.php
@@ -20,12 +20,14 @@ class dba {
function __construct($server,$user,$pass,$db,$install = false) {
$this->db = @new mysqli($server,$user,$pass,$db);
- if((mysqli_connect_errno()) && (! $install)) {
+ if(! mysqli_connect_errno()) {
+ $this->connected = true;
+ }
+ else {
$this->db = null;
- system_unavailable();
+ if(! $install)
+ system_unavailable();
}
- else
- $this->connected = true;
}
public function getdb() {
@@ -34,7 +36,7 @@ class dba {
public function q($sql) {
- if(! $this->db )
+ if((! $this->db) || (! $this->connected))
return false;
$result = @$this->db->query($sql);
@@ -92,7 +94,8 @@ class dba {
}
public function escape($str) {
- return @$this->db->real_escape_string($str);
+ if($this->db && $this->connected)
+ return @$this->db->real_escape_string($str);
}
function __destruct() {