示例#1
0
文件: mysql.php 项目: Zunair/xataface
 /**
  * Disconnects from the database server
  *
  * @return bool  TRUE on success, FALSE on failure
  */
 function disconnect()
 {
     $ret = @xf_db_close($this->connection);
     $this->connection = null;
     return $ret;
 }
示例#2
0
function fnSQLtoXML($sSQL, $oConn = '')
{
    //Returns an XML data island from an SQL statement or an error string
    if (!$oConn and !($oConn = @xf_db_connect(DB_HOST, DB_USER, DB_PASSWORD))) {
        $sRetVal = xf_db_error();
    } else {
        if (!mysql_selectdb(DB_NAME, $oConn)) {
            $sRetVal = xf_db_error();
        } else {
            if (!($result = xf_db_query($sSQL, $oConn))) {
                $sRetVal = xf_db_error();
            } else {
                while ($line = xf_db_fetch_array($result, MYSQL_ASSOC)) {
                    $sRetVal = "\n<" . mysql_field_table($result, 0) . ">";
                    $iThisField = 0;
                    foreach ($line as $col_value) {
                        $oTMP = mysql_fetch_field($result, $iThisField);
                        $iThisField++;
                        $sThisFieldName = $oTMP->name;
                        $sRetVal .= "\n\t<{$sThisFieldName} value=" . $col_value . ">";
                        $sRetVal .= "</{$sThisFieldName}>";
                    }
                    $sRetVal .= "\n</" . mysql_field_table($result, 0) . ">\n";
                }
                xf_db_free_result($result);
            }
        }
        xf_db_close($oConn);
    }
    return $sRetVal;
}
示例#3
0
                if ($row = @xf_db_fetch_array($result)) {
                    xf_db_free_result($result);
                    xf_db_close($cid);
                    $phpThumb->setSourceData($row[0]);
                    unset($row);
                } else {
                    xf_db_free_result($result);
                    xf_db_close($cid);
                    $phpThumb->ErrorImage('no matching data in database.');
                }
            } else {
                xf_db_close($cid);
                $phpThumb->ErrorImage('Error in MySQL query: "' . xf_db_error($cid) . '"');
            }
        } else {
            xf_db_close($cid);
            $phpThumb->ErrorImage('cannot select MySQL database: "' . xf_db_error($cid) . '"');
        }
    } else {
        $phpThumb->ErrorImage('cannot connect to MySQL server');
    }
    unset($_GET['id']);
}
////////////////////////////////////////////////////////////////
// Debug output, to try and help me diagnose problems
$phpThumb->DebugTimingMessage('phpThumbDebug[2]', __FILE__, __LINE__);
if (@$_GET['phpThumbDebug'] == '2') {
    $phpThumb->phpThumbDebug();
}
////////////////////////////////////////////////////////////////
if (@$PHPTHUMB_CONFIG['cache_default_only_suffix'] && strpos($PHPTHUMB_CONFIG['cache_default_only_suffix'], '*') !== false) {