當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sql::get_array方法代碼示例

本文整理匯總了PHP中sql::get_array方法的典型用法代碼示例。如果您正苦於以下問題:PHP sql::get_array方法的具體用法?PHP sql::get_array怎麽用?PHP sql::get_array使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sql的用法示例。


在下文中一共展示了sql::get_array方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: searchCategoryByName

 /**
  * @access public
  */
 function searchCategoryByName($name)
 {
     $query = 'SELECT id FROM ' . OOMedia::getTableName() . ' WHERE name = "' . addslashes($name) . '"';
     $sql = new sql();
     $result = $sql->get_array($query);
     $media = array();
     foreach ($result as $line) {
         $media[] = OOMediaCategory::getCategoryById($line['id']);
     }
     return $media;
 }
開發者ID:BackupTheBerlios,項目名稱:redaxo,代碼行數:14,代碼來源:class.oomediacategory.inc.php

示例2: CHECKONOFFSTATUS

function CHECKONOFFSTATUS()
{
    $db = new sql();
    $today = date("Ymd");
    $sql = "\n\tSELECT id,status\n\tFROM rex_article WHERE\n\t(online_von <= '{$today}' AND online_von != '' AND online_bis = '' AND status='0')\n\tOR\n\t(online_von <= '{$today}' AND online_von != '' AND online_bis >= '{$today}' AND status='0')\n\tOR\n\t(online_von = '' AND online_bis >= '{$today}' AND status='0')\n\tOR\n\t(online_von < '{$today}' AND online_bis < '{$today}' AND online_von != '' AND online_bis != '' AND status='0')\n\tOR\n\t(online_bis < '{$today}' AND online_bis != '' AND online_von = '' AND status='1')\n\tOR\n\t(online_bis < '{$today}' AND online_bis != '' AND online_von > '{$today}' AND status='1')\n\tOR\n\t(online_bis < '{$today}' AND online_von < '{$today}' AND online_von != '' AND online_bis != '' AND status='1')\n\tOR\n\t(online_bis > '{$today}' AND online_von > '{$today}' AND online_von != '' AND online_bis != '' AND status='1')\n\t";
    $result = $db->get_array($sql);
    if (is_array($result)) {
        foreach ($result as $var) {
            $status = $var[status] == 0 ? 1 : 0;
            $sql = "UPDATE rex_article SET status = '{$status}' WHERE id='{$var['id']}'";
            $db->setQuery($sql);
        }
    }
}
開發者ID:BackupTheBerlios,項目名稱:redaxo,代碼行數:14,代碼來源:function_onoff.inc.php

示例3: getURLbyID

function getURLbyID($ArticleID)
{
    if (!$ArticleID) {
        return '';
    }
    global $REX;
    if ($REX[MOD_REWRITE]) {
        $db = new sql();
        $sql = "SELECT name FROM rex_article WHERE id='{$ArticleID}'";
        $res = $db->get_array($sql);
        $url = $ArticleID . "-" . ModRewriteName($res[0][name]);
    } else {
        $url = 'index.php?article_id=' . $ArticleID;
    }
    return $url;
}
開發者ID:BackupTheBerlios,項目名稱:redaxo-svn,代碼行數:16,代碼來源:function_rex_modrewrite.inc.php

示例4: enterObject

 function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
 {
     foreach ($email_elements as $k => $v) {
         if ($this->elements[3] == $k) {
             $value = $v;
         }
     }
     $gd = new sql();
     // $gd->debugsql = 1;
     $gd->setQuery('select * from ' . $this->elements[1] . ' where ' . $this->elements[2] . '="' . addslashes($v) . '"');
     if ($gd->getRows() == 1) {
         $ar = $gd->get_array();
         foreach ($ar[0] as $k => $v) {
             $email_elements[$k] = $v;
         }
     }
     return;
 }
開發者ID:BackupTheBerlios,項目名稱:redaxo-svn,代碼行數:18,代碼來源:class.xform.readtable.inc.php

示例5: read

 function read()
 {
     global $REX;
     $sql = new sql();
     // $sql->debugsql = true;
     $sql->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . '51_cache_article WHERE article_id=' . $this->article_id . ' AND clang=' . $this->clang);
     $this->vars = array();
     if ($sql->getRows() > 0) {
         $result = $sql->get_array();
         $this->vars = $result[0];
     }
 }
開發者ID:BackupTheBerlios,項目名稱:redaxo-addons,代碼行數:12,代碼來源:class.config.inc.php

示例6: sql

} else {
    // ----- eigene typen definieren
    if ($function == "Update" or $function == "Ändern") {
        $update = new sql();
        $update->setTable("rex_article_type");
        $update->where("type_id='{$type_id}'");
        $update->setValue("name", $typname);
        $update->setValue("description", $description);
        $update->update();
        $type_id = 0;
        $function = "";
        $message = $I18N->msg("article_type_updated");
    } elseif ($function == "Delete" or $function == "Löschen") {
        if ($type_id != 1) {
            $delete = new sql();
            $result = $delete->get_array("SELECT name,id FROM rex_article WHERE type_id = {$type_id}");
            if (is_array($result)) {
                $message = $I18N->msg("article_type_still_used") . "<br>";
                foreach ($result as $var) {
                    $message .= "<br><a href=index.php?page=content&article_id=" . $var[id] . "&mode=meta target=_blank>" . $var[name] . "</a>";
                }
                $message .= "<br><br>";
            } else {
                $delete->query("delete from rex_article_type where type_id='{$type_id}'");
                $delete->query("update rex_article set type_id='1' where type_id='{$type_id}'");
                $message = $I18N->msg("article_type_deleted");
            }
        } else {
            $message = $I18N->msg("article_type_could_not_be_deleted");
        }
    } elseif ($function == "add" && $save == 1) {
開發者ID:BackupTheBerlios,項目名稱:redaxo-svn,代碼行數:31,代碼來源:specials.inc.php

示例7: sliceClear

 function sliceClear($slice_content)
 {
     global $REX, $REX_ACTION;
     for ($i = 1; $i < 11; $i++) {
         // ----------------------------- LIST BUTTONS
         // REX_FILELIST_BUTTON
         $media = "<table class=rexbutton><tr>";
         $media .= "<td valign=top><select name=REX_MEDIALIST_SELECT_{$i} id=REX_MEDIALIST_SELECT_{$i} size=8 class=inpgrey100>";
         $medialistarray = explode(",", $REX_ACTION['MEDIALIST'][$i]);
         if (is_array($medialistarray)) {
             for ($j = 0; $j < count($medialistarray); $j++) {
                 if (current($medialistarray) != "") {
                     $media .= "<option value='" . current($medialistarray) . "'>" . current($medialistarray) . "</option>\n";
                 }
                 next($medialistarray);
             }
         }
         $media .= "</select></td>";
         $media .= "<td class=inpicon>" . "<a href=javascript:moveREXMedialist({$i},'top');><img src=pics/file_top.gif width=16 height=16 vspace=2 title='^^' border=0></a>" . "<br><a href=javascript:moveREXMedialist({$i},'up');><img src=pics/file_up.gif width=16 height=16 vspace=2 title='^' border=0></a>" . "<br><a href=javascript:moveREXMedialist({$i},'down');><img src=pics/file_down.gif width=16 height=16 vspace=2 title='v' border=0></a>" . "<br><a href=javascript:moveREXMedialist({$i},'bottom');><img src=pics/file_bottom.gif width=16 height=16 vspace=2 title='vv' border=0></a></td>";
         $media .= "<td class=inpicon>" . "<a href=javascript:openREXMedialist({$i});><img src=pics/file_add.gif width=16 height=16 vspace=2 title='+' border=0></a>" . "<br><a href=javascript:deleteREXMedialist({$i});><img src=pics/file_del.gif width=16 height=16 vspace=2 title='-' border=0></a></td>";
         $media .= "</tr>";
         $media .= "<input type=hidden name=REX_MEDIALIST_{$i} value='REX_MEDIALIST[{$i}]' id=REX_MEDIALIST_{$i} >";
         $media .= "</table><br><br>";
         $slice_content = str_replace("REX_MEDIALIST_BUTTON[{$i}]", $media, $slice_content);
         $slice_content = str_replace("REX_MEDIALIST[{$i}]", $REX_ACTION['MEDIALIST'][$i], $slice_content);
         // REX_LINKLIST_BUTTON
         $media = "<input type=text size=30 name=REX_LINKLIST_{$i} value='REX_LINKLIST[{$i}]' class=inpgrey id=REX_LINKLIST_{$i} read2only=readonly>";
         $media = $this->stripPHP($media);
         $slice_content = str_replace("REX_LINKLIST_BUTTON[{$i}]", $media, $slice_content);
         $slice_content = str_replace("REX_LINKLIST[{$i}]", "", $slice_content);
         // ----------------------------- REX_MEDIA_BUTTON
         $media = "<table class=rexbutton><input type=hidden name=REX_MEDIA_DELETE_{$i} value=0 id=REX_MEDIA_DELETE_{$i}><tr>";
         $media .= "<td><input type=text size=30 name=REX_MEDIA_{$i} value='REX_FILE[{$i}]' class=inpgrey100 id=REX_MEDIA_{$i} readonly=readonly></td>";
         $media .= "<td class=inpicon><a href=javascript:openREXMedia({$i}," . $this->clang . ");><img src=pics/file_open.gif width=16 height=16 title='medienpool' border=0></a></td>";
         $media .= "<td class=inpicon><a href=javascript:deleteREXMedia({$i}," . $this->clang . ");><img src=pics/file_del.gif width=16 height=16 title='-' border=0></a></td>";
         $media .= "<td class=inpicon><a href=javascript:addREXMedia({$i}," . $this->clang . ")><img src=pics/file_add.gif width=16 height=16 title='+' border=0></a></td>";
         $media .= "</tr></table>";
         $media = $this->stripPHP($media);
         $slice_content = str_replace("REX_MEDIA_BUTTON[{$i}]", $media, $slice_content);
         $slice_content = str_replace("REX_FILE[{$i}]", $REX_ACTION['FILE'][$i], $slice_content);
         // ----------------------------- REX_LINK_BUTTON
         $link_name = "";
         if ($REX_ACTION['LINK'][$i] > 0) {
             $db = new sql();
             $sql = "SELECT name FROM " . $REX['TABLE_PREFIX'] . "article WHERE id=" . $REX_ACTION[LINK][$i] . " and clang=" . $this->clang;
             $res = $db->get_array($sql);
             $link_name = $res[0]['name'];
         }
         $media = "<table class=rexbutton><input type=hidden name=REX_LINK_DELETE_{$i} value=0 id=REX_LINK_DELETE_{$i}><input type=hidden name='LINK[{$i}]' value='REX_LINK[{$i}]' id=LINK[{$i}]><tr>";
         $media .= "<td><input type=text size=30 name='LINK_NAME[{$i}]' value='{$link_name}' class=inpgrey100 id=LINK_NAME[{$i}] readonly=readonly></td>";
         $media .= "<td class=inpicon><a href=javascript:openLinkMap({$i}," . $this->clang . ");><img src=pics/file_open.gif width=16 height=16 title='Linkmap' border=0></a></td>";
         $media .= "<td class=inpicon><a href=javascript:deleteREXLink({$i}," . $this->clang . ");><img src=pics/file_del.gif width=16 height=16 title='-' border=0></a></td>";
         $media .= "</tr></table>";
         $media = $this->stripPHP($media);
         $slice_content = str_replace("REX_LINK_BUTTON[{$i}]", $media, $slice_content);
         $slice_content = str_replace("REX_LINK[{$i}]", $REX_ACTION['LINK'][$i], $slice_content);
         $slice_content = str_replace("REX_LINK_ID[{$i}]", $REX_ACTION['LINK'][$i], $slice_content);
         // ----------------------------- REX_ OTHER
         $slice_content = str_replace("REX_VALUE[{$i}]", htmlspecialchars(stripslashes($REX_ACTION['VALUE'][$i])), $slice_content);
         $slice_content = str_replace("REX_HTML_VALUE[{$i}]", "", $slice_content);
         $slice_content = str_replace("REX_PHP_VALUE[{$i}]", "", $slice_content);
         $slice_content = str_replace("REX_IS_VALUE[{$i}]", "", $slice_content);
     }
     $slice_content = str_replace("REX_PHP", htmlspecialchars(stripslashes($REX_ACTION['PHP'])), $slice_content);
     $slice_content = str_replace("REX_HTML", htmlspecialchars(stripslashes($REX_ACTION['HTML'])), $slice_content);
     //    $slice_content = str_replace("REX_ARTICLE_ID","",$slice_content);
     //    $slice_content = str_replace("REX_CUR_CLANG","",$slice_content);
     //    $slice_content = str_replace("REX_CATEGORY_ID","",$slice_content);
     $slice_content = $this->replaceCommonVars($slice_content);
     return $slice_content;
 }
開發者ID:BackupTheBerlios,項目名稱:redaxo-svn,代碼行數:71,代碼來源:class.article.inc.php

示例8: generateCategory

    if ($order == 'down') {
        $sql->order_down($order_id, $o_table, 'prior', $o_which, $o_cat);
    }
    if ($order == 'top') {
        $sql->order_top($order_id, $o_table, 'prior', $o_which, $o_cat);
    }
    if ($order == 'bottom') {
        $sql->order_bottom($order_id, $o_table, 'prior', $o_which, $o_cat);
    }
    // generate articles an cats
    if ($o_table == "rex_category") {
        generateCategory($o_cat);
        generateCategoryList($o_cat);
    }
    if ($o_table == "rex_article") {
        $res = $sql->get_array("SELECT id FROM rex_article WHERE category_id = {$o_cat} AND prior = {$order_id}");
        generateArticle($res[0][id]);
    }
}
$STRUCTURE_PERM = FALSE;
if ($REX_USER->isValueOf("rights", "structure[all]")) {
    $STRUCTURE_PERM = TRUE;
}
// --------------------------------------------- category pfad
include $REX[INCLUDE_PATH] . "/functions/function_rex_category.inc.php";
title($I18N->msg("title_structure"), $KATout);
// --------------------------------------------- name check $kat_name, $category_name
// --------------------------------------------- category functions
if ($function == "edit_category" && $STRUCTURE_PERM && $edit_id != "") {
    $message = $I18N->msg("category_updated");
    $KAT->query("update rex_category set name='{$kat_name}' where id='{$edit_id}'");
開發者ID:BackupTheBerlios,項目名稱:redaxo,代碼行數:31,代碼來源:structure.inc.php

示例9: addSqlValues

 /**
  * Fügt dem Feld neue Werte via SQL-Query hinzu.
  * Dieser Query muss ein 2 Spaltiges Resultset beschreiben.
  * 
  * @param $query SQL-Query
  * @access protected
  */
 function addSqlValues($query)
 {
     $sql = new sql();
     //      $sql->debugsql = true;
     $result = $sql->get_array($query, MYSQL_NUM);
     if (is_array($result) && count($result) >= 1) {
         $value = array_shift($result);
         if (count($value) > 2) {
             rexForm::triggerError('Query "' . $query . '" affects more than 2 columns!');
         }
         if (count($value) == 2) {
             // Add first Option
             $this->addValue($value[0], $value[1]);
             foreach ($result as $value) {
                 // Add remaing Options
                 $this->addValue($value[0], $value[1]);
             }
         } elseif (count($value) == 1) {
             // Add first Option
             $this->addValue($value[0], $value[0]);
             foreach ($result as $value) {
                 // Add remaing Options
                 $this->addValue($value[0], $value[0]);
             }
         }
     }
 }
開發者ID:BackupTheBerlios,項目名稱:gbforredaxo,代碼行數:34,代碼來源:class.rex_formMultiValueField.inc.php

示例10: sql

} else {
    // ----- eigene typen definieren
    if (isset($function) and $function == $I18N->msg("update_button")) {
        $update = new sql();
        $update->setTable($REX['TABLE_PREFIX'] . "article_type");
        $update->where("type_id='{$type_id}'");
        $update->setValue("name", $typname);
        $update->setValue("description", $description);
        $update->update();
        $type_id = 0;
        $function = "";
        $message = $I18N->msg("article_type_updated");
    } elseif (isset($function) and $function == $I18N->msg("delete_button")) {
        if ($type_id != 1) {
            $delete = new sql();
            $result = $delete->get_array("SELECT name,id FROM " . $REX['TABLE_PREFIX'] . "article WHERE type_id = {$type_id}");
            if (is_array($result)) {
                $message = $I18N->msg("article_type_still_used") . "<br>";
                foreach ($result as $var) {
                    $message .= '<br /><a href="index.php?page=content&amp;article_id=' . $var['id'] . '&amp;mode="meta" target="_blank">' . $var['name'] . '</a>';
                }
                $message .= '<br /><br />';
            } else {
                $delete->query("DELETE FROM " . $REX['TABLE_PREFIX'] . "article_type WHERE type_id = '{$type_id}' LIMIT 1");
                $delete->query("UPDATE " . $REX['TABLE_PREFIX'] . "article SET type_id = '1' WHERE type_id = '{$type_id}'");
                $message = $I18N->msg("article_type_deleted");
            }
        } else {
            $message = $I18N->msg("article_type_could_not_be_deleted");
        }
    } elseif (isset($function) and $function == $I18N->msg('add') && isset($save) and $save == 1) {
開發者ID:BackupTheBerlios,項目名稱:redaxo-svn,代碼行數:31,代碼來源:specials.inc.php

示例11: sql

 /**
  * @access public
  */
 function &getMediaByFileName($name)
 {
     $query = 'SELECT file_id FROM ' . OOMedia::_getTableName() . ' WHERE filename = "' . $name . '"';
     $sql = new sql();
     $result = $sql->get_array($query);
     if (is_array($result)) {
         foreach ($result as $line) {
             return OOMedia::getMediaById($line['file_id']);
         }
     }
     return null;
 }
開發者ID:BackupTheBerlios,項目名稱:redaxo-svn,代碼行數:15,代碼來源:class.oomedia.inc.php

示例12: confirm

<?php

include $REX[INCLUDE_PATH] . "/layout/top.php";
rex_title("Live System Sync ", "\n&nbsp;&nbsp;&nbsp;\n<a href=index.php?page=live_system&function=sync onClick=\"return confirm('Live Sync wirklich durchführen?')\">Live Sync durchführen</a>");
if ($msg != "") {
    echo "<table border=0 cellpadding=5 cellspacing=1 width=770><tr><td class=warning>{$msg}</td></tr></table><br>";
}
?>

<?php 
if ($function == "sync") {
    $db = new sql();
    include $REX[INCLUDE_PATH] . "/addons/live_system/classes/function.syncMySQLData.inc.php";
    include $REX[INCLUDE_PATH] . "/addons/live_system/classes/class.MySQLDump.inc.php";
    $live_db = new sql("live_db");
    $res = $db->get_array("SHOW TABLES");
    print "&nbsp;&nbsp;<b>Starte Datenbanksync</b><br>";
    foreach ($res as $var) {
        $table = $var["Tables_in_" . $REX['DB']['1']['NAME']];
        $sql = "TRUNCATE {$table}";
        $live_db->query($sql);
    }
    print "&nbsp;&nbsp;<span id=dbc>0</span> Datenbankeintäge gesynct.";
    ?>
		<script>
			function dbc(){
				if(document.getElementById('dbcount')){
			    	document.getElementById('dbc').innerHTML = document.getElementById('dbcount').innerHTML.length;
			    }
			    window.setTimeout('dbc();', 100);
			}
開發者ID:BackupTheBerlios,項目名稱:redaxo-addons,代碼行數:31,代碼來源:index.inc.php

示例13: rex_a1_import_db

/**
 * Importiert den SQL Dump $filename in die Datenbank
 * 
 * @param string Pfad + Dateinamen zur SQL-Datei
 *  
 * @return array Gibt ein Assoc. Array zurück.
 *               'state' => boolean (Status ob fehler aufgetreten sind)
 *               'message' => Evtl. Status/Fehlermeldung  
 */
function rex_a1_import_db($filename, $replace_rex = false)
{
    global $REX, $I18N_IM_EXPORT;
    $return = array();
    $return['state'] = false;
    $return['message'] = '';
    $msg = '';
    $error = '';
    if ($filename == '') {
        $return['message'] = $I18N_IM_EXPORT->msg('no_import_file_chosen_or_wrong_version') . '<br>';
        return $return;
    }
    $h = fopen($filename, "r");
    $conts = fread($h, filesize($filename));
    fclose($h);
    // Versionsstempel prüfen
    // ## Redaxo Database Dump Version x.x
    $rex_version = strpos($conts, "## Redaxo Database Dump Version " . $REX['VERSION']);
    if ($rex_version === FALSE) {
        $return['message'] = $I18N_IM_EXPORT->msg("no_valid_import_file") . ". [## Redaxo Database Dump Version " . $REX['VERSION'] . "] is missing";
        return $return;
    } else {
        // Versionsstempel entfernen
        $conts = trim(str_replace("## Redaxo Database Dump Version " . $REX['VERSION'], "", $conts));
    }
    // Prefix prüfen
    // ## Prefix rex_
    $rex_prefix = strpos($conts, "## Prefix " . $REX['TABLE_PREFIX']);
    if ($replace_rex) {
        $conts = trim(str_replace("## Prefix rex_", "", $conts));
        $conts = str_replace("TABLE rex_", "TABLE " . $REX['TABLE_PREFIX'], $conts);
        $conts = str_replace("INTO rex_", "INTO " . $REX['TABLE_PREFIX'], $conts);
        $conts = str_replace("EXISTS rex_", "EXISTS " . $REX['TABLE_PREFIX'], $conts);
    } elseif ($rex_prefix === FALSE) {
        $return['message'] = $I18N_IM_EXPORT->msg("no_valid_import_file") . ". [## Prefix " . $REX['TABLE_PREFIX'] . "] does not match config in master.inc.php";
        return $return;
    } else {
        // Prefix entfernen
        $conts = trim(str_replace("## Prefix " . $REX['TABLE_PREFIX'], "", $conts));
    }
    // Ordner /generated komplett leeren
    rex_deleteDir($REX['INCLUDE_PATH'] . '/generated/articles');
    rex_deleteDir($REX['INCLUDE_PATH'] . '/generated/files');
    rex_deleteDir($REX['INCLUDE_PATH'] . '/generated/templates');
    // Datei aufteilen
    $lines = explode("\n", $conts);
    $add = new sql();
    // $add->debugsql = 1;
    foreach ($lines as $line) {
        $line = trim($line, "\r");
        // Windows spezifische extras
        $line = trim($line, ";");
        // mysql 3.x
        $add->setquery($line);
        $add->flush();
    }
    $msg .= $I18N_IM_EXPORT->msg("database_imported") . ". " . $I18N_IM_EXPORT->msg("entry_count", count($lines)) . "<br>";
    // CLANG Array aktualisieren
    unset($REX['CLANG']);
    $db = new sql();
    $db->setQuery("select * from " . $REX['TABLE_PREFIX'] . "clang");
    for ($i = 0; $i < $db->getRows(); $i++) {
        $id = $db->getValue("id");
        $name = $db->getValue("name");
        $REX['CLANG'][$id] = $name;
        $db->next();
    }
    // prüfen, ob eine user tabelle angelegt wurde
    $result = $db->get_array('SHOW TABLES');
    $user_table_found = false;
    foreach ($result as $row) {
        if (in_array($REX['TABLE_PREFIX'] . 'user', $row)) {
            $user_table_found = true;
            break;
        }
    }
    if (!$user_table_found) {
        $create_user_table = '
    CREATE TABLE ' . $REX['TABLE_PREFIX'] . 'user
     ( 
       user_id int(11) NOT NULL auto_increment,
       name varchar(255) NOT NULL,
       description text NOT NULL,
       login varchar(50) NOT NULL,
       psw varchar(50) NOT NULL,
       status varchar(5) NOT NULL,
       rights text NOT NULL,
       login_tries tinyint(4) NOT NULL DEFAULT 0,
       createuser varchar(255) NOT NULL,
       updateuser varchar(255) NOT NULL,
       createdate int(11) NOT NULL DEFAULT 0,
//.........這裏部分代碼省略.........
開發者ID:BackupTheBerlios,項目名稱:redaxo-svn,代碼行數:101,代碼來源:function_import_export.inc.php

示例14: gbook_pagination

function gbook_pagination($currentPage, $elementsPerPage, $paginationsPerPage)
{
    $qry = 'SELECT count(*) rowCount FROM ' . TBL_GBOOK;
    $sql = new sql();
    $data = $sql->get_array($qry);
    $oneSidePaginations = floor($paginationsPerPage / 2);
    //var_dump( $oneSidePaginations);
    $rowCount = $data[0]['rowCount'];
    //var_dump( $rowCount);
    $pageCount = ceil($rowCount / $elementsPerPage) + 1;
    //var_dump( $pageCount);
    if ($currentPage <= $oneSidePaginations) {
        $start = 1;
    } else {
        $start = $currentPage - $oneSidePaginations;
    }
    //var_dump( $start);
    $str = '';
    if ($currentPage != 0) {
        $str .= gbook_paginationurl(0, '&laquo;');
    }
    for ($i = 0; $i <= $paginationsPerPage; $i++) {
        if ($start == $pageCount) {
            break;
        }
        $str .= gbook_paginationurl($start - 1, $start);
        $start++;
    }
    if ($currentPage != $pageCount - 2) {
        $str .= gbook_paginationurl($pageCount - 2, '&raquo;');
    }
    return $str;
}
開發者ID:BackupTheBerlios,項目名稱:redaxo-addons,代碼行數:33,代碼來源:module.list.inc.php

示例15: _rex_dbmeta_get_colinfos

/**
 * @access private
 */
function _rex_dbmeta_get_colinfos($table, $database)
{
    global $REX;
    // Validate Arguments
    _rex_dbmeta_validate($table, $database, __FILE__, __LINE__);
    if (empty($REX['DB']['META'][$database]['TABLES'][$table]['COLNAMES'])) {
        $sql = new sql();
        $result = $sql->get_array('SHOW FULL COLUMNS FROM ' . $table . ' FROM ' . $database, MYSQL_NUM);
        $colums = array();
        $colnames = array();
        $primkeys = array();
        $autoinc = '';
        if (is_array($result)) {
            $serverVersion = sql::getServerVersion();
            $mainVersion = $serverVersion[0];
            foreach ($result as $row) {
                $column = array();
                $column['NAME'] = $row[0];
                $column['TYPE'] = $row[1];
                $column['NULL'] = $row[2];
                // Mysql 4<->5 versionsweiche
                switch ($mainVersion) {
                    case 4:
                        $column['KEY'] = $row[3];
                        $column['DEFAULT'] = $row[4];
                        $column['EXTRA'] = $row[5];
                        break;
                    case 5:
                        $column['KEY'] = $row[4];
                        $column['DEFAULT'] = $row[5];
                        $column['EXTRA'] = $row[6];
                        break;
                }
                $colums[] = $column;
                $colnames[] = $column['NAME'];
                // AutoInc
                if ($column['EXTRA'] == 'auto_increment') {
                    $autoinc = $column['NAME'];
                }
                // PrimaryKeys
                if ($column['KEY'] == 'PRI') {
                    $primkeys[] = $column['NAME'];
                }
            }
        }
        $REX['DB']['META'][$database]['TABLES'][$table]['COLUMNS'] = $colums;
        $REX['DB']['META'][$database]['TABLES'][$table]['COLNAMES'] = $colnames;
        $REX['DB']['META'][$database]['TABLES'][$table]['PRIMKEYS'] = $primkeys;
        $REX['DB']['META'][$database]['TABLES'][$table]['AUTOINC'] = $autoinc;
    }
}
開發者ID:BackupTheBerlios,項目名稱:gbforredaxo,代碼行數:54,代碼來源:function_rex_dbmeta.inc.php


注:本文中的sql::get_array方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。