本文整理汇总了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;
}
示例2: version
public function version()
{
if ($this->vval === NULL) {
$this->vval = pg_fetch_row(pg_query($this->res, 'SELECT version()'), 0);
}
return $this->vval;
}
示例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;
}
示例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;
}
示例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
}
示例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);
}
示例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!";
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例11: value
public function value()
{
if ($row = pg_fetch_row($this->result, 0)) {
return $row[0];
}
return false;
}
示例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;
}
示例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);
}
}
示例14: getNextLogId
function getNextLogId()
{
$qry = "select nextval('techmatcher.subscriptiontransactionlog_sq')";
$result = pg_query($qry);
$value = pg_fetch_row($result);
return $value;
}
示例15: listing
public function listing()
{
for ($list = array(); $row = pg_fetch_row($this->result); $list[] = $row[0]) {
}
$this->free();
return $list;
}