home *** CD-ROM | disk | FTP | other *** search
- <!--
- db2tab by Alessandro Grigiante
-
- Simple scripts to access IBM DB2 Universal DataBase tables through PHP ODBC funtions.
- -->
-
-
-
- <HTML>
- <BODY TEXT=#FFFFFF BGCOLOR=#000050>
- <HEAD>
- <META HTTP-EQUIV="pragma" CONTENT="no-cache">
- </HEAD>
- <!-- db2tab.php ---->
- <!-- Purpose: Simple scripts to access IBM DB2 Universal DataBase tables through ---->
- <!-- PHP ODBC funtions. ---->
- <!-- Author: Alessandro Grigiante (ale@teknoline.it) ---->
- <!-- Copyright: Copyright (C) 2000 Alessandro Grigiante. Subject to the ---->
- <!-- GNU Public License (GPL) - may be used and modified at will, ---->
- <!-- so long as license and all attribution is retained. ---->
- <!-- Disclaimer: Like most free software, no warranty is expressed or implied. ---->
- <!-- If it doesn't work, feel free to fix it yourself. ---->
- <!-- Tested on: AIX 4.3.0.0 - IBM DB2 5.3 UDB - Apache/1.3.6 (Unix) - PHP/3.0.11 ---->
- <!-- Solaris 2.7 - IBM DB2 6.1 UDB - Apache/1.3.11 (Unix) - PHP/4.0b3 ---->
- <!-- Available on: ftp://ftp.teknoline.it/pub/php/db2tab.tar.gz ---->
- <!-- ---->
- <CENTER>
- <FONT SIZE=+2>DB2Tables - List IBM DB2 Universal Data Base Tables with PHP</FONT><BR>
-
- <?
- include "db2tab.inc";
-
- /* ******* Remember to set proper DB2INSTANCE environment variable
- * Run /your_db2user_home_dir/sqllib/db2profile before to start Apache.
- * IBM DB2 connection with PHP3/4 over ODBC.
- * by ale @Mon Sep 13 21:45:29 DFT 1999
- */
-
- $select = "SELECT TABNAME ";
- $from = "FROM SYSCAT.TABLES ";
- $where = "WHERE TABSCHEMA='$tabschema'";
-
- /*** Connect to database................. ***/
- $c = odbc_pconnect($dbname,$user,$password);
-
- if ($c > 0) {
- $query = $select . $from . $where;
-
- /* Warning.................
- * Use odbc_exec instead of odbc_prepare + odbc_execute
- * no bugs and faster.
- */
- $res = odbc_exec($c, $query);
- $nc=odbc_num_fields($res);
- $nr=odbc_num_rows($res);
-
- echo "<TABLE BORDER=1><TD BGCOLOR=#888888>\n";
- /* Call to create multi switch POST form in HTML */
- create_form3($res,$nr,$nc,$act,$c);
- echo "</TABLE>\n";
-
- /* Free all resources and close connection */
- odbc_free_result($res);
- odbc_close($c);
-
- } else {
- echo "BAD CONNECTION Number $c \n";
- echo "--> $php_errormsg \n";
- }
-
- ?>
- </CENTER>
- </BODY>
- </HTML>
-
-