Location: PHPKode > scripts > WH Social > wh_social/framework/class/photo_class.php
<?php

    class LoadAlbum {
        var $sDbName;
        var $sDbUser;
        var $sDbPass;
        var $vLink;

    function LoadAlbum() {
        define('INCLUDE_CHECK',1);
        include('framework/config.php');
        $this->sDbName = $mysql_data;
        $this->sDbUser = $mysql_user;
        $this->sDbPass = $mysql_pass;
        $this->vLink = mysql_connect($mysql_host, $this->sDbUser, $this->sDbPass);

    mysql_select_db($this->sDbName, $this->vLink);
    }

    function getOne($query, $index = 0) {
        if(!$query)
            return FALSE;

            $result = mysql_query($query);
            $array_result = array();

    if($result && mysql_num_rows($result))
        $array_result = mysql_fetch_assoc($result);

    if(count($array_result))
        return $array_result[$index];

        else

        return FALSE;
        }

    function res($query, $error_checking = TRUE) {
        if(!$query)
            return FALSE;

            $result = mysql_query($query, $this->vLink) OR die(mysql_error());

    if(!$result)
        $this->error('Es ist ein Fehler aufgetreten', FALSE, $query);

        return $result;
        }

    function getPairs($query, $sFieldKey, $sFieldValue, $array_type = MYSQL_ASSOC) {
        if(!$query)
        return array();

        $result = $this->res($query);
        $array_result = array();

    if($result) {
        while($row = mysql_fetch_assoc($result, MYSQL_ASSOC)) {
        $array_result[$row[$sFieldKey]] = $row[$sFieldValue];
        }

        mysql_free_result($result);
        }

    return $array_result;
    }

    function getAll($query, $array_type = MYSQL_ASSOC) {
        if(!$query)
        return array();

    if($array_type != MYSQL_ASSOC && $array_type != MYSQL_NUM && $array_type != MYSQL_BOTH)
        $array_type = MYSQL_ASSOC;
        $result = $this->res($query);
        $array_result = array();

    if($result) {
        while($row = mysql_fetch_assoc($result, $array_type))
        $array_result[] = $row;

        mysql_free_result($result);
        }

    return $array_result;
    }

    function getRow($query, $array_type = MYSQL_ASSOC) {
        if(!$query)
        return array();

    if($array_type != MYSQL_ASSOC && $array_type != MYSQL_NUM && $array_type != MYSQL_BOTH)
        $array_type = MYSQL_ASSOC;
        $result = $this->res ($query);
        $array_result = array();

    if($result && mysql_num_rows($result)) {
        $array_result = mysql_fetch_assoc($result, $array_type);

        mysql_free_result($result);
        }

    return $array_result;
    }

    function escape($show) {
        return mysql_real_escape_string(strip_tags($show));
        }

    function lastId() {
        return mysql_insert_id($this->vLink);
        }

    function error($text, $isForceErrorChecking = FALSE, $sSqlQuery = '') {
        echo $text; exit;
        }
    }

    $PHOTOS['album'] = new LoadAlbum();

?>
Return current item: WH Social