PHP 手冊
上一頁 |  | 下一頁

# ingres_connect

(PHP 4 >= 4.0.2, PHP 5)

ingres_connect -- Open a connection to an Ingres II database

## Description

resource ingres_connect ( [string database [, string username [, string password]]])

切記!
這個函數是實驗性質的。這個函數的行為、名稱、和關於此函數的任何其他文件在未來PHP的發行中可能會在不通知的情況下改變。 使用此延伸需自行承擔風險。

Returns a Ingres II link resource on success, or `FALSE` on failure.

ingres_connect() opens a connection with the Ingres database designated by database, which follows the syntax [node_id::]dbname[/svr_class].

If some parameters are missing, ingres_connect() uses the values in `php.ini` for ingres.default_database, ingres.default_user, and ingres.default_password.

The connection is closed when the script ends or when ingres_close() is called on this link.

All the other ingres functions use the last opened link as a default, so you need to store the returned value only if you use more than one link at a time.

示範 1.ingres_connect() example

`<?php $link = ingres_connect("mydb", "user", "pass") or die("Could not connect"); echo "Connected successfully"; ingres_close($link); ?>`

示範 2. ingres_connect() example using default link

`<?php ingres_connect("mydb", "user", "pass") or die("Could not connect"); echo "Connected successfully"; ingres_close(); ?>`

See also ingres_pconnect() and ingres_close().

上一頁 | 最開頭 | 下一頁
ingres_commit | 上一層 | ingres_fetch_array