用户评论:

[#1]

eddie at eddiemonge dot com [2009-10-06 17:09:31]

pg_fetch_row is faster than pg_fetch_assoc when doing a query with * as the select parameter. Otherwise, with declared columns, the two are similar in speed.

[#2]

pletiplot at seznam dot cz [2006-06-06 15:18:42]

Note, that when you retrieve some PG boolean value, you get 't' or 'f' characters which are not compatible with PHP bool.

[#3]

post at zeller-johannes dot de [2005-04-26 14:51:53]

I wondered whether array values of PostgreSQL are converted to PHP arrays by this functions. This is not the case, they are stored in the returned array as a string in the form "{value1 delimiter value2 delimiter value3}" (See http://www.postgresql.org/docs/8.0/interactive/arrays.html#AEN5389).

[#4]

maxnamara at yahoo dot com [2004-10-14 00:03:01]

Get downlines, put them into arrays.

function get_downlines($my_code){

global $link;

$sql = "select user_id, name from tb_user where parentcode = $my_code";

$res = pg_query($link,$sql);

if(!$res){

echo "Error: ".$sql;exit();

}

$num_fields = pg_num_fields($res);

$info_rows = 0;

$num_rows = pg_num_rows($res);

while($arr = pg_fetch_row($res)){

$info_offset  = 1;

$info_columns  = 0;

while ($info_offset <= $num_fields) {

$info_elements[$info_rows][$info_columns] = $arr[$info_columns];

$info_offset++; $info_columns++;

}

$info_rows++;

}

return $info_elements;

}

[#5]

Matthew Wheeler [2003-05-22 21:29:53]

Note that the internal row counter is incremented BEFORE the row is retrieved. This causes an off by one error if you try to do:

pg_result_seek($resid,0);

pg_fetch_row($resid);

you will get back the SECOND result not the FIRST.

[#6]

imantr at cbn dot net dot id [2002-07-23 20:38:55]

I use the following code to assigning query result to an array.

while ($row = pg_fetch_row($result)) $newArray[] = $row[0];

print_r($newArray);

[#7]

darw75 at swbell dot net [2001-08-22 17:39:23]

a way to do this with 2 loops to insert data into a table...

$num = pg_numrows($result);

$col_num = pg_numfields($result);

for ($i=0; $i

$line  = pg_fetch_array($result, $i, PGSQL_ASSOC);

print "\t

\n";

for ($j=0; $j

list($col_name, $col_value) =each($line);

print "\t\t

$col_value\n";

}

echo "
";

}

php pg_fetch_row,pg_fetch_row相关推荐

  1. php postgresql多条,PHP操作Postgresql封装类与应用完整实例

    本文实例讲述了PHP操作Postgresql封装类与应用.分享给大家供大家参考,具体如下: 这个类封装了一些常用的函数,原帖里面还有事务处理的内容,以后再学习吧. 类文件定义: class pgsql ...

  2. php如何抓取一行的内容,提取一行作为对象 - PHP 7 中文文档

    (PHP 4, PHP 5, PHP 7) pg_fetch_object – 提取一行作为对象 说明 pg_fetch_object ( resource $result [, int $row [ ...

  3. php postgresql多条,PHPPostgreSQL函数列表 - phpStudy

    echo $r["fun"].' '.$r["title"]; ?> PostgreSQL函数列表 pg_close - 关闭一个 PostgreSQL ...

  4. [转]php连接postgresql

    首先推荐一下postgres数据库,免费,强大,甚至某些方面比商业数据库还要好,大家可以试试. 安装: 附安装图解(网上找的):http://blog.sina.com.cn/s/blog_5edb7 ...

  5. php连接postgresql数据库

    例 1767. PostgreSQL 例子 <?php // 连接,选择数据库 $dbconn = pg_connect("host=localhost dbname=publishi ...

  6. Uedit32高亮文件(加强)

    替换根目录下 wordfile.txt / /L1"C/C++" C_LANG Line Comment = // Block Comment On = /* Block Comm ...

  7. PHP编程 967 个函式 值得收藏

    967 个函式 Abs: 取得绝对值.  Acos: 取得反余弦值.  ada_afetch: 取得资料库的传回列.  ada_autocommit: 开关自动更动功能.  ada_close: 关闭 ...

  8. May 18:PHP 函数

    a 函数    说明 abs    绝对值 acos    反余弦 acosh    反双曲余弦 addcslashes    以 C 语言风格使用反斜线转义字符串中的字符 addslashes    ...

  9. php 函数索引 中文索引

    PHP 函数索引 (共有 967 个函数) Abs: 取得绝对值. Acos: 取得反余弦值. ada_afetch: 取得数据库的返回列. ada_autocommit: 开关自动改动功能. ada ...

最新文章

  1. $(function() {})是干什么的及作用
  2. 一文弄懂各种loss function
  3. OpenYurt 联手 eKuiper,解决 IoT 场景下边缘流数据处理难题
  4. 使用apache的HttpGet\HttpPost获取返回内容编码问题
  5. android支持色彩管理软件,安卓首家!OPPO全链路色彩管理系统亮相:全局支持10bit照片视频...
  6. mysql strcmp s1 s2_mysql常用函数
  7. JVM调优_堆内存溢出和非堆内存溢出
  8. Linux 命令(105)—— service 命令
  9. Android 和 iOS 各有千秋
  10. Azure Storage Explorer
  11. python抓取网站内容_python抓取网站内容详细
  12. vdbench多主机运行指导
  13. Windows HTTP服务(WinHTTP)介绍
  14. element中table表格和已选数据联动
  15. 零基础爬取堆糖网图片(一)
  16. 杨咩咩的编程求学之路之开篇
  17. 深度势能 deep potential
  18. 计算机图像处理之形状变换
  19. 从现在开始,格外珍惜时间,让生活充实起来
  20. 优雅java代码效率提高的习惯(一)

热门文章

  1. 如何计算一组数据的波动幅度_如何用Excel计算一个投资组合(双资产/三资产)的波动率?...
  2. 微型计算机2014年6月上,2014年6月福建省计算机一级考试选择题及答案
  3. SpringCloud 服务网关 Zuul 自定义路由和排除路由配置
  4. c语言超长整数加法计算,两个超长正整数的加法
  5. 基于JAVA+SpringMVC+Mybatis+MYSQL的大学生考勤管理系统及智能分析系统
  6. 基于JAVA+Servlet+JSP+MYSQL的酒店管理系统
  7. linux下浏览器如何登录微信,js判断手机浏览器操作系统和微信浏览器的方法
  8. mysql 连接其他数据库_普通用户从其他主机连接MySQL数据库
  9. python 归纳 (二二)_多进程数据共享和同步_管道Pipe
  10. 通过telnet来实践HTTP协议。