Table of Contents |
---|
...
ALTIBASE HDB supports standard ODBC, so you can use these ODBC functions in PHP to interface with the ALTIBASE HDB server.
For a detailed description of the ODBC functions used in PHP, refer to the PHP official manual site below:
http://php.morva.net/manual/kr/index.php
Sample Test
Code Block | ||
---|---|---|
| ||
<?php // SYSTEM DSN, USER_ID, USER_PASSWORD $conn = odbc_connect('TESTDSN', 'SYS', 'MANAGER'); if ($conn) { // direct-execution echo "now, i create table t1 (id integer, name char(20)<br>"; odbc_exec ( $conn, "drop table t1" ); odbc_exec ( $conn, "create table t1 (id integer, name char(20))" ); // prepare-execution echo "now, i insert into t1 value (100, Lee)<br>"; $stmt = odbc_prepare ( $conn, "insert into t1 values (?, ?)" ); $Insert = array (100, "Lee"); if (! odbc_execute ( $stmt, $Insert )) { echo ("error"); } // single-selection $res = odbc_do ( $conn, "select id, name, sysdate from T1" ); odbc_fetch_row ( $res ); $ID = odbc_result ( $res, 1 ); $NAME = odbc_result ( $res, 2 ); $DATE = odbc_result ( $res, 3 ); echo ("id = $ID , name = $NAME datetime = $DATE <br>"); odbc_close ( $conn ); } else { echo "connection failed ..."; } ?> |