PHP怎样连接Postgresql,并且查询数据 PHP怎样连接Postgresql,并且查询数据 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Example #1 pg_fetch_array() example<?php $conn = pg_pconnect("dbname=publisher");if (!$conn) { echo "An error occured.\n"; exit;}$result = pg_query($conn, "SELECT author, email FROM authors");if (!$result) { echo "An error occured.\n"; exit;}$arr = pg_fetch_array($result, 0, PGSQL_NUM);echo $arr[0] . " <- Row 1 Author\n";echo $arr[1] . " <- Row 1 E-mail\n";// As of PHP 4.1.0, the row parameter is optional; NULL can be passed instead,// to pass a result_type. Successive calls to pg_fetch_array will return the// next row.$arr = pg_fetch_array($result, NULL, PGSQL_ASSOC);echo $arr["author"] . " <- Row 2 Author\n";echo $arr["email"] . " <- Row 2 E-mail\n";$arr = pg_fetch_array($result);echo $arr["author"] . " <- Row 3 Author\n";echo $arr[1] . " <- Row 3 E-mail\n";?> 学习学习 www.tw1234.cn 学习学习 www.tw1234.cn 学习学习 www.tw1234.cn bugfree 输入日历下拉框的功能(PHP+js)火狐和opera实现,但IE6 有没有PHP开发的固定资产管理系统??!! php 模拟GMAIL,HOTMAIL(MSN),YAHOO,163,126邮箱登录(原创) nginx配置问题,把index.php当目录解析 fatal error:Cannot redeclare getreqhmacstrings() PHP 多线程扩展开发 paypal接口问题 关于伪静态,smarty技术,数据库数据丢失问题 求一段简单的正则表达式 跪求上php神级选手!! 關於mysql 數據庫連接量 关于康盛的SUPERSITE注册问题,高手请来.
if (!$conn) {
echo "An error occured.\n";
exit;
}$result = pg_query($conn, "SELECT author, email FROM authors");
if (!$result) {
echo "An error occured.\n";
exit;
}$arr = pg_fetch_array($result, 0, PGSQL_NUM);
echo $arr[0] . " <- Row 1 Author\n";
echo $arr[1] . " <- Row 1 E-mail\n";// As of PHP 4.1.0, the row parameter is optional; NULL can be passed instead,
// to pass a result_type. Successive calls to pg_fetch_array will return the
// next row.
$arr = pg_fetch_array($result, NULL, PGSQL_ASSOC);
echo $arr["author"] . " <- Row 2 Author\n";
echo $arr["email"] . " <- Row 2 E-mail\n";$arr = pg_fetch_array($result);
echo $arr["author"] . " <- Row 3 Author\n";
echo $arr[1] . " <- Row 3 E-mail\n";?>