postgreSQL连接数据库
来源:互联网 发布:ubuntu记事本 编辑:程序博客网 时间:2024/05/17 21:51
<?php
// 连接,选择数据库
$db = pg_connect("host=localhost dbname=publishing user=www password=foo");
or die('Could not connect: ' .pg_last_error());
// 执行 SQL 查询
$query = 'SELECT * FROM authors';
$result = pg_query($query) or die('Query failed: '. pg_last_error());
// 用 HTML 显示结果
echo "<table>\n";
while ($line =pg_fetch_array($result,null, PGSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as$col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
// 释放结果集
pg_free_result($result);
// 关闭连接
pg_close($link);
?>
// 连接,选择数据库
$db = pg_connect("host=localhost dbname=publishing user=www password=foo");
or die('Could not connect: ' .pg_last_error());
// 执行 SQL 查询
$query = 'SELECT * FROM authors';
$result = pg_query($query) or die('Query failed: '. pg_last_error());
// 用 HTML 显示结果
echo "<table>\n";
while ($line =pg_fetch_array($result,null, PGSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as$col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
// 释放结果集
pg_free_result($result);
// 关闭连接
pg_close($link);
?>
- VB6连接PostgreSQL数据库
- 远程连接postgreSQL数据库
- postgreSQL连接数据库
- 菜刀连接postgresql数据库
- ADOConnection 连接PostgreSQL数据库
- C#连接postgresql数据库
- Java连接PostgreSQL数据库
- pgAdmin连接postgresql数据库
- Java连接postgresql数据库
- hibernate 连接postgresql数据库
- JAVA连接PostgreSQL数据库
- PHP 连接PostgreSql数据库代码
- myeclipse6.5连接PostgreSQL数据库
- postgresql jdbc 连接数据库测试
- JDBC连接之PostgreSQL数据库
- 如何远程连接POSTGRESQL数据库
- postgresql无密码连接数据库
- PostgreSQL数据库远程连接配置
- paip.AJAX回调函数不起作用的解决
- Defining Classes and Objects
- Python 判斷目前的 DLL or EXE 是32bit 還是 64bit
- QT中的元对象系统(二):创建自定义的QT类型
- Android内存(内存溢出 内存不足 内存低 .)优化详解.
- postgreSQL连接数据库
- QML中的Model View——一个ListView实例
- 《疯狂Java讲义》读书笔记——面向对象(上)
- 文件操作
- Android中源码Launcher主屏幕程序排列详解【安卓Launcher进化一】
- Qt中的事件机制
- String.prototype使用
- jsp下载文件的实现方法 及 注意
- IOS 使用Block