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


PHP pg_fetch_row函数代码示例

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


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

示例1: getKind

    function getKind()
    {
        $sql = 'SELECT org.id, org.navn, org.kortnavn, org.orgnr
		    FROM org
		    WHERE org.id IN (
		        SELECT org_id
		            FROM tjenesteabonnement
		                JOIN status_codes_tjenesteabonnement ON tjenesteabonnement.status = status_codes_tjenesteabonnement.id
		                JOIN tjeneste ON tjenesteabonnement.tjeneste_id = tjeneste.id
		            WHERE status_codes_tjenesteabonnement.status=\'Installert\'
		                AND tjeneste.navn = \'urn:mace:feide.no:services:no.uninett.feidekundeportal\'
        )';
        $res = pg_query($this->db, $sql);
        $data = array();
        while ($row = pg_fetch_row($res)) {
            $newEntry = array('orgnr' => FeedBuilder::slim($row[3]), 'kind.kortnavn' => $row[2], 'kind.title' => $row[1], 'kind.id' => $row[0]);
            // $this->add(array('id' => $row[0]), $newEntry);
            // $this->addEntry($newEntry);
            // print_r($newEntry);
            $data[] = $newEntry;
            if (preg_match('/ kommune/', $row[0])) {
            }
        }
        return $data;
    }
开发者ID:NIIF,项目名称:DiscoJuice-Backend,代码行数:25,代码来源:KIND.php

示例2: version

 public function version()
 {
     if ($this->vval === NULL) {
         $this->vval = pg_fetch_row(pg_query($this->res, 'SELECT version()'), 0);
     }
     return $this->vval;
 }
开发者ID:rakesh-mohanta,项目名称:grocery,代码行数:7,代码来源:PgSQL.php

示例3: getStartEndDate

function getStartEndDate($cons_id)
{
    $query = "select subscriptioneffectivedate,subscriptionenddate from techmatcher.currentsubscribers_vw where itconsumer_id = \$1;";
    $result = pg_query_params($query, array($cons_id));
    $row = pg_fetch_row($result);
    return $row;
}
开发者ID:nkpajsmith,项目名称:nealsgit2,代码行数:7,代码来源:email.php

示例4: execute

 /**
  *
  * @param type $query
  * @param type $type
  * @return type
  */
 public function execute($query, $type = null)
 {
     $result = array();
     switch ($this->db_engine) {
         case "pgsql":
             $resultado = pg_query($this->conn, $query);
             while ($row = pg_fetch_row($resultado)) {
                 $result[] = $row;
             }
             pg_close($this->conn);
             break;
         case "mssql":
             $resultado = odbc_exec($this->conn, $query);
             while ($row = odbc_fetch_array($resultado)) {
                 $result[] = $row;
             }
             break;
         case "mysql":
             $result = array();
             $resultado = mysql_query($query);
             if (gettype($resultado) == "boolean") {
                 $result = $resultado;
             } else {
                 while ($row = mysql_fetch_row($resultado)) {
                     $result[] = $row;
                 }
             }
             mysql_close($this->conn);
             break;
     }
     return $result;
 }
开发者ID:emildev35,项目名称:distribuidos,代码行数:38,代码来源:Conexion.php

示例5: Afficher

 public function Afficher()
 {
     // - On se connecte à la base de données
     parent::ConnecterBD();
     // - on récupère des infos de la session
     $account_id = $_SESSION['account_id'];
     // - on récupère les paramètres
     $message_id = $_GET['no_message'];
     // - On récupère les données
     $sql = "SELECT is_read, object, message, date_envoi FROM \"libertribes\".\"MESSAGE\" WHERE account_id = {$account_id} AND message_id = {$message_id} AND type = 1 AND is_delete = 0";
     $result = parent::Requete($sql);
     if ($result) {
         $row = pg_fetch_row($result);
         if ($row) {
             // - on stocke le message
             $_SESSION['messagerie_lire_id'] = $message_id;
             $_SESSION['messagerie_lire_is_read'] = $row[0];
             $_SESSION['messagerie_lire_object'] = $row[1];
             $_SESSION['messagerie_lire_message'] = $row[2];
             $_SESSION['messagerie_lire_date_envoi'] = $row[3];
             $_SESSION['messagerie_lire_heure_envoi'] = "XXhXX";
         }
     }
     parent::Afficher();
     // - gestion spécifique de la page
 }
开发者ID:domiboo,项目名称:libertribes_fromneosys,代码行数:26,代码来源:class_page_messagerie_lire.php

示例6: fetch_referendums

 function fetch_referendums($status, $start, $pagelen, $search, $order)
 {
     global $dbconn, $expanded_referendums;
     global $sql_names;
     global $sql_select, $sql_from, $sql_where;
     global $sql_fud_names, $sql_fud_select, $sql_fud_from, $sql_fud_where;
     global $sql_type_select, $sql_type_from, $sql_type_where;
     $sql_fetch = " from" . "  (select " . $sql_select . $sql_fud_select . $sql_type_select . "    from " . $sql_from . $sql_fud_from . $sql_type_from . "    where " . $sql_where . $sql_fud_where . $sql_type_where . "    order by i.referendum) as v" . " where " . $search;
     $sql = "select count(*) from (select distinct on (referendum) referendum " . $sql_fetch . " group by referendum) as r";
     $row = pg_fetch_row(pg_query($dbconn, $sql)) or die('Could query: ' . pg_last_error());
     $len = (int) $row[0];
     $sql = "select * " . $sql_fetch . " order by " . $order;
     " limit " . ($start + $pagelen);
     $rows = pg_query($dbconn, $sql) or die('Could query: ' . pg_last_error());
     pg_result_seek($rows, $start);
     $v = array();
     while ($row = pg_fetch_row($rows)) {
         $row = array_combine($sql_names, $row);
         $row['expanded'] = in_array($row['referendum'], $expanded_referendums);
         if (!isset($v[count($v) - 1]) || $v[count($v) - 1]['referendum'] != $row['referendum']) {
             $v[] = $row;
         } else {
             if (!isset($v[count($v) - 1]['subrows'])) {
                 $v[count($v) - 1]['subrows'] = array($v[count($v) - 1]);
             }
             $v[count($v) - 1]['subrows'][] = $row;
         }
     }
     return array('len' => $len, 'referendums' => $v);
 }
开发者ID:redhog,项目名称:DemoWave,代码行数:30,代码来源:referendums.php

示例7: control

function control()
{
    global $result, $input, $u_id;
    $conn = pg_connect("host=postgredb.ctnfr2pmdvmf.us-west-2.rds.amazonaws.com port=5432 dbname=postgreDB user=postgreuser password=6089qwerty");
    if (!$conn) {
        echo "denied An error occurred.\n";
        exit;
    }
    ini_set('date.timezone', 'America/Los_Angeles');
    $time = date('H:i:s', time());
    $date = date('Y-m-d') . " " . $time;
    $result = pg_query($conn, "SELECT FRIENDLISTID FROM FRIENDLIST WHERE USERID='{$u_id}' AND FRIENDID='{$input}'");
    $row = pg_fetch_row($result);
    if ($row[0]) {
        return "ALREADY A FRIEND";
    } else {
        if (pg_query($conn, "INSERT INTO FRIENDLIST ( USERID, FRIENDID,FRIENDLISTTIME) VALUES ('{$u_id}','{$input}',TIMESTAMP'{$date}')") == TRUE) {
            if (pg_query($conn, "INSERT INTO FRIENDLIST ( USERID, FRIENDID,FRIENDLISTTIME) VALUES ('{$input}','{$u_id}',TIMESTAMP'{$date}')") == TRUE) {
                return "New record created successfully";
            } else {
                return "denied. Only one way relationship inserted!";
            }
        } else {
            return "denied. Insertion query error!";
        }
    }
}
开发者ID:serten,项目名称:ProjectPAL,代码行数:27,代码来源:addFriend_postgre.php

示例8: getLastId

function getLastId($db)
{
    $last_uid = pg_query($db, "SELECT uid FROM uif ORDER BY uid DESC");
    $last_uid = pg_fetch_row($last_uid, 0);
    $last_uid = $last_uid[0];
    return $last_uid;
}
开发者ID:danielbertolozi,项目名称:feedcluster,代码行数:7,代码来源:functions.php

示例9: Row

 /**
  * Get a row from the RecordSet.
  *
  * Case $row is set, return that row, case else, return the next row.
  *
  * @param int $row Row to return, defaults to next.
  * @param int $type Type of array to return (RS_ROW_NUM | RS_ROW_ASSOC | RS_ROW_BOTH).
  * @return array Returns the row from the RecordSet, or FALSE if EOF.
  */
 function Row($row = -1, $type = RS_ROW_ASSOC)
 {
     if ($row != -1) {
         $this->row = $row + 1;
         switch ($type) {
             case RS_ROW_NUM:
                 return pg_fetch_row($this->result, $this->row - 1);
                 break;
             case RS_ROW_ASSOC:
                 return pg_fetch_assoc($this->result, $this->row - 1);
                 break;
             case RS_ROW_BOTH:
                 return pg_fetch_array($this->result, $this->row - 1);
                 break;
         }
         return FALSE;
     }
     $this->row++;
     switch ($type) {
         case RS_ROW_NUM:
             return pg_fetch_row($this->result);
             break;
         case RS_ROW_ASSOC:
             return pg_fetch_assoc($this->result);
             break;
         case RS_ROW_BOTH:
             return pg_fetch_array($this->result);
             break;
     }
     return FALSE;
 }
开发者ID:JAMNConsultoria,项目名称:cataforte,代码行数:40,代码来源:RS_PostgreSQL.class.php

示例10: postgis_query

function postgis_query($string, $pgc = NULL)
{
    $pgct = $pgc;
    if ($pgc == NULL) {
        $pgct = postgis_connect();
    }
    @($result = pg_query($pgct, $string));
    if ($pgc == NULL) {
        pg_close($pgct);
    }
    $retval = array();
    if (!$result) {
        return $retval;
    }
    $arow = array();
    for ($i = 0; $i < pg_num_fields($result); $i++) {
        $arow[pg_field_name($result, $i)] = pg_field_type($result, $i);
    }
    $retval[0] = $arow;
    $ctr = 1;
    while ($row = pg_fetch_row($result)) {
        $arow = array();
        for ($i = 0; $i < count($row); $i++) {
            $arow[pg_field_name($result, $i)] = $row[$i];
        }
        $retval[$ctr] = $arow;
        $ctr++;
    }
    pg_free_result($result);
    return $retval;
}
开发者ID:rvaidya,项目名称:FlexGIS,代码行数:31,代码来源:helper.php

示例11: value

 public function value()
 {
     if ($row = pg_fetch_row($this->result, 0)) {
         return $row[0];
     }
     return false;
 }
开发者ID:Stoiss777,项目名称:s,代码行数:7,代码来源:Result.php

示例12: Check

 public function Check($uid = 0)
 {
     $sql = "SELECT uid FROM birthday08 WHERE uid='" . $uid . "'";
     $res = pg_query(DBConnect(), $sql);
     list($ch) = pg_fetch_row($res);
     return $ch;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:7,代码来源:birthday08.php

示例13: __construct

 /**
  * Generate our fancypants Query Exception
  * @param $error
  * @param $sql
  * @return Exception
  */
 public function __construct($resource, $sql, Debug $debug)
 {
     $this->sql = $sql;
     $this->sqlError = pg_last_error($resource);
     // get the search path and add to exception message
     try {
         $qSearchPath = pg_query($resource, "SHOW search_path");
         $searchPath = pg_fetch_row($qSearchPath);
         $this->sqlError .= "\nSEARCH_PATH IS '{$searchPath[0]}'";
     } catch (\Exception $e) {
     }
     // build the debugging events we plan to emit
     $events = [self::QUERY_ERROR];
     // Not exactly happy to be doing this manually. Not cool postgres. Not cool.
     // http://www.postgresql.org/docs/8.4/static/errcodes-appendix.htm
     if ($haveState = preg_match('/ERROR:\\s+([A-Z0-9]{5}):/', $this->sqlError, $matches)) {
         $this->state = $matches[1];
         for ($i = 5; $i > 0; $i--) {
             $events[] = str_pad(substr($this->state, 0, $i), 5, '0');
         }
     } else {
         $this->state = 'EMPTY';
     }
     // emit out events
     foreach ($events as $eventName) {
         $debug->emit($eventName, $this->sql, $this->sqlError, $this->state);
     }
 }
开发者ID:squareproton,项目名称:bond,代码行数:34,代码来源:QueryExceptionFactory.php

示例14: getNextLogId

function getNextLogId()
{
    $qry = "select nextval('techmatcher.subscriptiontransactionlog_sq')";
    $result = pg_query($qry);
    $value = pg_fetch_row($result);
    return $value;
}
开发者ID:nkpajsmith,项目名称:nealsgit2,代码行数:7,代码来源:subscription.php

示例15: listing

 public function listing()
 {
     for ($list = array(); $row = pg_fetch_row($this->result); $list[] = $row[0]) {
     }
     $this->free();
     return $list;
 }
开发者ID:jongharvey,项目名称:mocha-database,代码行数:7,代码来源:Result.php


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