当前位置: 首页>>代码示例>>PHP>>正文


PHP pg_fetch_all_columns函数代码示例

本文整理汇总了PHP中pg_fetch_all_columns函数的典型用法代码示例。如果您正苦于以下问题:PHP pg_fetch_all_columns函数的具体用法?PHP pg_fetch_all_columns怎么用?PHP pg_fetch_all_columns使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pg_fetch_all_columns函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: draw_svg

function draw_svg($pie_id, $base_name, $args)
{
    global $output_dir;
    global $svg_template;
    global $bg_schemes;
    $bar_start = 48;
    $bar_end = 312.4;
    $bar_len = $bar_end - $bar_start;
    $svg_output = $output_dir . $base_name . '.svg';
    if (file_exists($svg_output)) {
        return $svg_output;
    }
    // Parse
    $xdoc = new DomDocument();
    $xdoc->Load($svg_template);
    $xp = new DomXPath($xdoc);
    // Get progress from DB
    $result = pg_query("SELECT state FROM pieces WHERE pie = " . $pie_id);
    $states = pg_fetch_all_columns($result, 0);
    $progress = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    $full_sum = 9 * count($states);
    $current_sum = 0;
    foreach ($states as $st) {
        $progress[$st]++;
        $current_sum += $st;
    }
    // Calculate bars positions and widths
    $offset = $bar_start;
    $step = $bar_len / count($states);
    for ($i = 0; $i <= 9; $i++) {
        $elem = find_by_id($xp, 'bar_' . $i);
        $elem->setAttribute('x', $offset);
        $elem->setAttribute('width', $step * $progress[$i]);
        $offset += $step * $progress[$i];
    }
    // Set percent
    $percent = round($current_sum / $full_sum * 100);
    find_by_id($xp, 'percent-fg')->nodeValue = $percent . '%';
    // Set BG color gradient;
    $current_bg_scheme = $bg_schemes['middle'];
    if ($progress[9] / count($states) > 0.6) {
        $current_bg_scheme = $bg_schemes['high'];
    } else {
        if ($progress[0] / count($states) > 0.6) {
            $current_bg_scheme = $bg_schemes['low'];
        }
    }
    find_by_id($xp, 'bg-grd-start')->setAttribute('style', 'stop-color:#' . $current_bg_scheme[0] . ';stop-opacity:1');
    find_by_id($xp, 'bg-grd-stop')->setAttribute('style', 'stop-color:#' . $current_bg_scheme[1] . ';stop-opacity:1');
    // Save it to file
    if (($fd = fopen($svg_output, 'w')) === false) {
        throw new Exception("Cant open SVG file for saving");
    }
    fwrite($fd, $xdoc->saveXML());
    fclose($fd);
    return $svg_output;
}
开发者ID:nicevoice,项目名称:MapCraft,代码行数:57,代码来源:progress1.php

示例2: manyToOneQuery

 function manyToOneQuery($ar)
 {
     $z = extract($ar);
     //$act=($this->useWiki) ? ' WHERE active>0 ' : '';
     $SQL = "SELECT DISTINCT {$many} FROM " . $this->tabl;
     $rZ = $this->xQuery($SQL, 0);
     $aList = compileList(',', pg_fetch_all_columns($rZ));
     pg_free_result($rZ);
     $act = $useWiki ? 'WHERE active>0 AND ' : 'WHERE ';
     $SQL = "SELECT DISTINCT {$key},{$var} FROM {$tabl} {$act} " . "{$key} IN (" . implode(',', $aList) . ")";
     return $SQL;
 }
开发者ID:quercusluver,项目名称:tfrec-web-dev,代码行数:12,代码来源:qOnFly8.php

示例3: _update_users_claims

function _update_users_claims($res, $from, $to_all)
{
    global $connection;
    $user_list = array('user_list', array());
    $claim_list = array('claim_list', array());
    // Buffer array
    $users = array();
    $result = pg_query($connection, 'SELECT pieces.id, pieces.index, users.nick, users.color FROM pieces JOIN users ON users.id = pieces.owner WHERE pie = ' . $from->pieid . ' ORDER BY pieces.index');
    $piece_ids = pg_fetch_all_columns($result, 0);
    // Users who has pieces
    while ($row = pg_fetch_assoc($result)) {
        if (isset($users[$row['nick']])) {
            $users[$row['nick']]['owns'][] = $row['index'];
        } else {
            $users[$row['nick']] = array('owns' => array($row['index']), 'color' => array($row['color']), 'online' => false);
        }
    }
    if (count($piece_ids) != 0) {
        $result = pg_query($connection, 'SELECT claims.id, users.nick, users.color, pieces.index, score FROM claims JOIN pieces on claims.piece = pieces.id JOIN users ON users.id = claims.author WHERE piece IN (' . implode(',', $piece_ids) . ')');
        while ($row = pg_fetch_assoc($result)) {
            $claim_list[1][] = array('claim_id' => $row['id'], 'piece_index' => $row['index'], 'vote_balance' => $row['score'], 'owner' => $row['nick']);
            // Users who has claims
            if (!isset($users[$row['nick']])) {
                $users[$row['nick']] = array('owns' => array(), 'color' => array($row['color']), 'online' => false);
            }
        }
    }
    // Adding all online users:  chat_members JOIN users
    $result = pg_query($connection, 'SELECT users.id, users.nick, users.color FROM chat_members LEFT JOIN users ON users.id = member WHERE pie = ' . $from->pieid);
    while ($row = pg_fetch_assoc($result)) {
        // If new user -> set it fully
        if (!isset($users[$row['nick']])) {
            $users[$row['nick']] = array('owns' => array(), 'color' => array($row['color']));
        }
        $users[$row['nick']]['online'] = true;
    }
    // Generating user_list from userbuffer array
    foreach ($users as $user_nick => $attrs) {
        $user_list[1][] = array('user_nick' => $user_nick, 'color' => $attrs['color'], 'reserved' => $attrs['owns'], 'online' => $attrs['online']);
    }
    if ($to_all) {
        $res->to_pie($from, $user_list);
        $res->to_pie($from, $claim_list);
    } else {
        $res->to_sender($user_list);
        $res->to_sender($claim_list);
    }
}
开发者ID:nicevoice,项目名称:MapCraft,代码行数:48,代码来源:users.php

示例4: as_array

 public function as_array($key = NULL, $value = NULL)
 {
     if ($this->_total_rows === 0) {
         return array();
     }
     if (!$this->_as_object and $key === NULL) {
         // Rewind
         $this->_current_row = 0;
         if ($value === NULL) {
             // Indexed rows
             return pg_fetch_all($this->_result);
         }
         // Indexed columns
         return pg_fetch_all_columns($this->_result, pg_field_num($this->_result, $value));
     }
     return parent::as_array($key, $value);
 }
开发者ID:alekseyshavrak,项目名称:3cx,代码行数:17,代码来源:Result.php

示例5: ChangeBuckets

 function ChangeBuckets()
 {
     global $SysConf;
     global $PG_CONN;
     $uploadId = GetParm("upload", PARM_STRING);
     $uploadTreeId = GetParm("item", PARM_STRING);
     $sql = "SELECT bucketpool_fk from bucket_ars where upload_fk = {$uploadId};";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     $bucketpool_array = pg_fetch_all_columns($result, 0);
     pg_free_result($result);
     $buckets_dir = $SysConf['DIRECTORIES']['MODDIR'];
     /** rerun bucket on the file */
     foreach ($bucketpool_array as $bucketpool) {
         $command = "{$buckets_dir}/buckets/agent/buckets -r -t {$uploadTreeId} -p {$bucketpool}";
         exec($command);
     }
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:18,代码来源:change-license-processPost.php

示例6: selectCol

 public function selectCol($query)
 {
     $result = call_user_func_array([$this, 'query'], func_get_args());
     return pg_fetch_all_columns($result, 0);
 }
开发者ID:deltaphp,项目名称:deltadb,代码行数:5,代码来源:PgsqlAdapter.php

示例7: fetchColumn

 /**
  * fetchColumn
  *
  * Fetch a column from a result.
  *
  * @access public
  * @param  string $name
  * @return array
  */
 public function fetchColumn($name)
 {
     return pg_fetch_all_columns($this->handler, $this->getFieldNumber($name));
 }
开发者ID:pomm-project,项目名称:foundation,代码行数:13,代码来源:ResultHandler.php

示例8: GetJobList

/**
 * \brief Gets the list of jobqueue records with the requested $status 
 *
 * \param string $status - the status might be:
 *        Started, Completed, Restart, Failed, Paused, etc
 *        the status 'Started' and 'Restart', you can call them as running status
 *        to get all the running job list, you can set the $status as 'tart'
 *
 * \return job list related to the jobstatus,
 *         the result is like: Array(1, 2, 3, .., i), sorted
 **/
function GetJobList($status)
{
    /* Gets the list of jobqueue records with the requested $status */
    global $PG_CONN;
    if (empty($status)) {
        return;
    }
    $sql = "SELECT jq_pk FROM jobqueue WHERE jq_endtext like '%{$status}%' order by jq_pk;";
    $result = pg_query($PG_CONN, $sql);
    DBCheckResult($result, $sql, __FILE__, __LINE__);
    $job_array = pg_fetch_all_columns($result, 0);
    pg_free_result($result);
    return $job_array;
}
开发者ID:DanielDobre,项目名称:fossology,代码行数:25,代码来源:common-job.php

示例9: getDBColumn_SQL

function getDBColumn_SQL($SQL)
{
    $r = newQuery($SQL, 0);
    $ar = pg_fetch_all_columns($r, 0);
    pg_free_result($r);
    return $ar;
}
开发者ID:quercusluver,项目名称:tfrec-web-dev,代码行数:7,代码来源:toolBoxV3.php

示例10: pg_exec

</table>
<br />
<?php 
//run query
if (isset($_REQUEST["SearchBtn"])) {
    $ret = pg_exec($db_handle, $new_str);
    if (!$ret) {
        echo "<br />Query Failed!\n";
        var_dump($ret);
    } else {
        //print out table containing the query
        $record_found = pg_numrows($ret);
        echo "<p>{$record_found} records found!</p>";
        $q_array = pg_fetch_all_columns($ret, 3);
        $region_array = pg_fetch_all_columns($ret, 1);
        $id_array = pg_fetch_all_columns($ret, 0);
        echo "<table border=1 bgcolor='white' cellspacing=7 cellpadding=2>";
        echo "<tr><th>\"State\"</th><th>\"Region\"</th><th>\"Link\"</th></tr>";
        for ($i = 0; $i < count($q_array); $i++) {
            if (strlen($q_array[$i]) == 0) {
                $str_out = "UNKNOWN";
            } else {
                $str_out = $q_array[$i];
            }
            echo "<tr><td>{$str_out}</td>";
            if (strlen($region_array[$i]) == 0) {
                $str_out2 = "UNKNOWN";
            } else {
                $str_out2 = $region_array[$i];
            }
            echo "<td>{$str_out2}</td>";
开发者ID:jordanmcgowan,项目名称:cs640,代码行数:31,代码来源:index.php

示例11: _update_user_reserved

function _update_user_reserved($res, $from, $user_id, $nick)
{
    global $connection;
    $result = pg_query($connection, 'SELECT index FROM pieces WHERE owner = ' . $user_id . ' and pie = ' . $from->pieid . ' ORDER BY index');
    $piece_indexes = pg_fetch_all_columns($result, 0);
    if ($piece_indexes === false) {
        $piece_indexes = array();
    }
    $res->to_pie($from, array('user_update', array('current_nick' => $nick, 'reserved' => $piece_indexes)));
}
开发者ID:nicevoice,项目名称:MapCraft,代码行数:10,代码来源:pieces.php

示例12: get_fieldset_sql

 /**
  * Selects records and return values (first field) as an array using a SQL statement.
  *
  * @param string $sql The SQL query
  * @param array $params array of sql parameters
  * @return array of values
  * @throws dml_exception A DML specific exception is thrown for any errors.
  */
 public function get_fieldset_sql($sql, array $params = null)
 {
     list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
     $this->query_start($sql, $params, SQL_QUERY_SELECT);
     $result = pg_query_params($this->pgsql, $sql, $params);
     $this->query_end($result);
     $return = pg_fetch_all_columns($result, 0);
     pg_free_result($result);
     return $return;
 }
开发者ID:kevin-bruton,项目名称:moodle,代码行数:18,代码来源:pgsql_native_moodle_database.php

示例13: display_menubar

function display_menubar()
{
    if (!isset($_SESSION['athlete_id'])) {
        echo <<<ENDHTML
\t<H2>Your session has expired</H2>
\t<FONT size=1>Please <a href=index.php >return to the <u>login page</u> and log in again.<a></FONT><br>
ENDHTML;
        exit;
    }
    $login = $_SESSION['login'];
    $athlete_id = $_SESSION['athlete_id'];
    require_once "access_check.php";
    $filename = basename(__FILE__);
    #access_check( $filename ) ;
    // Connect to DB
    include_once "sql_functions.php";
    #$dbconn = pg_connect("host=localhost dbname=training_diary user=athlete password=ironman")
    # or die('Could not connect: ' . pg_last_error());
    $query = "SELECT name from athlete WHERE athlete_id = {$athlete_id}";
    #$result = pg_query($query) or die('Query failed: ' . pg_last_error());
    $result = do_sql($query);
    $row = pg_fetch_array($result, null, PGSQL_ASSOC);
    $firstname = $row['name'];
    $query = "SELECT function FROM user_access WHERE athlete_id = '{$athlete_id}'";
    $result = do_sql($query) or die('Query failed: ' . pg_last_error());
    $allowed = pg_fetch_all_columns($result, 0);
    echo <<<HTMLEND

<TABLE>
<TR><TD align=right class=fitnessmad  >
<b><font size=3 color=#885555 >
<i> FitnessMad.Net </i>
</FONT><br/>
<font color=#AA5555 >
Training Log
</FONT>
</b>
</TD><TD class=mainmenu align=right valign=bottom >
&nbsp;&nbsp;&nbsp; 
You are logged in {$firstname}<br>
</TD>
</TR>
</TABLE>

<HR>
HTMLEND;
    echo <<<ENDHTML

  <TABLE><TR><TD>
  <UL class="nav">

ENDHTML;
    // Assume we want to jump to today's date, won't do anything if
    // this is not in the date range selected.
    $jumpto = "anchorD" . date("Ymd");
    // View My Log
    if (in_array("view_log.php", $allowed)) {
        echo <<<HTMLEND

  <LI class=menuheader ><a href="view_log.php#{$jumpto}"> View My Log</a> 
  </LI>

HTMLEND;
    }
    // Add Log Entry
    $date = date("d/m/Y");
    if (in_array("add_log_entry.php", $allowed)) {
        echo <<<HTMLEND

  <LI class=menuheader >
    <!-- <a href="javascript:launchRemote('add_log_entry.php#{$jumpto}')" >  -->
    <a href="javascript:launchRemote('add_log_entry.php?start_date={$date}')" >
    Add Log entry</a>
  </LI>

HTMLEND;
    }
    // Start dropdown menu for Configuration options
    echo <<<CONFIGMENU

    <li class=menuheader ><a >Configuration</a>
    <ul>

CONFIGMENU;
    if (in_array("configure_view.php", $allowed)) {
        echo <<<CONFIGMENU

\t<li><a href="configure_view.php">
\t\tConfigure View</a></li>

CONFIGMENU;
    }
    if (in_array("configure_log_entry.php", $allowed)) {
        echo <<<CONFIGMENU

\t<li><a href="configure_log_entry.php">
\t\tConfigure Log Entry Fields</a></li>

CONFIGMENU;
    }
//.........这里部分代码省略.........
开发者ID:robincj,项目名称:tlog,代码行数:101,代码来源:menubar.php

示例14: is_authentified

 function is_authentified()
 {
     global $DB;
     $res = $DB->tab_result("SELECT * FROM admin_svg.utilisateur WHERE login = '" . $this->user . "' AND psw = '" . $this->pass . "';");
     if (count($res) == 0) {
         return 0;
     } else {
         $this->insee = $res[0]['idcommune'];
         $res2 = $DB->tab_result("SELECT idagglo FROM admin_svg.commune WHERE idcommune = '" . $res[0]['idcommune'] . "';");
         $this->idagglo = $res2[0]['idagglo'];
         $this->idutilisateur = $res[0]['idutilisateur'];
         $this->droit = $res[0]['droit'];
         $this->droit_appli = "";
         $this->acces_ssl = true;
         $res1 = pg_query($DB->con, "select application.libelle_appli from admin_svg.application inner join admin_svg.apputi on admin_svg.application.idapplication=admin_svg.apputi.idapplication join admin_svg.utilisateur on admin_svg.apputi.idutilisateur=admin_svg.utilisateur.idutilisateur where apputi.idutilisateur='" . $res[0]['idutilisateur'] . "' order by application.type_appli asc;");
         $this->liste_appli = pg_fetch_all_columns($res1, 0);
         $this->roles[] = 2;
         if ($res[0]['droit'] == 'AD') {
             // FIXME: affiner la gestion des droits
             $this->roles[] = 1;
         }
         return 1;
     }
 }
开发者ID:josuerodriguesbr,项目名称:Gismeaux,代码行数:24,代码来源:profiles.php

示例15: getRowList

 function getRowList()
 {
     if ($this->useWiki) {
         $useAct = ' WHERE active>0 ';
     } else {
         $useAct = '';
     }
     $wh = $this->sqlSubset();
     if ($wh and !$useAct) {
         $useAct = ' WHERE ';
     } elseif ($wh) {
         $useAct .= ' AND ';
     } else {
         $nought = 0;
     }
     if ($wh) {
         $useAct .= $wh;
     }
     $r = $this->xQuery("SELECT " . $this->indx . "," . $this->getDisplayText() . " FROM " . $this->tabl . " {$useAct} ORDER BY " . $this->getDisplayText() . ";", 1);
     $ids = pg_fetch_all_columns($r, 0);
     $names = pg_fetch_all_columns($r, 1);
     pg_free_result($r);
     return array_combine($ids, $names);
 }
开发者ID:quercusluver,项目名称:tfrec-web-dev,代码行数:24,代码来源:dbToolsV8.php


注:本文中的pg_fetch_all_columns函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。