note 96265 added to function.odbc-connect

From: Date: Wed, 17 Feb 2010 21:08:18 +0000
Subject: note 96265 added to function.odbc-connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-166091@lists.php.net to get a copy of this message
Once you've set up a UnixODBC connection to Informix (as described elsewhere, for example in http://www.unixodbc.org/), the following PHP code will access a database via its DSN: <?php // We must set these environment variables for Informix to work. Either // do it here or in php.ini. putenv("INFORMIXDIR=/usr/share/informix"); putenv("ODBCINI=/usr/local/unixODBC/etc/odbc.ini"); // Open up a connection to the database. if (!($con = odbc_connect("CollectOh", "", ""))) echo "<p>Connection to CollectOh failed.</p>\n"; else { // Let's try enumerating all of the tables in the database (there ain't // no "show tables" here). if (($res = odbc_exec($con, "select * from SYSTABLES"))) { echo "<p>\n"; odbc_result_all($res); echo "</p>\n"; } // Close up shop, like good dobies. odbc_close($con); } ?> ---- Server IP: 192.41.40.227 Probable Submitter: 68.160.190.203 ---- Manual Page -- http://www.php.net/manual/en/function.odbc-connect.php Edit -- https://master.php.net/note/edit/96265 Del: integrated -- https://master.php.net/note/delete/96265/integrated Del: useless -- https://master.php.net/note/delete/96265/useless Del: bad code -- https://master.php.net/note/delete/96265/bad+code Del: spam -- https://master.php.net/note/delete/96265/spam Del: non-english -- https://master.php.net/note/delete/96265/non-english Del: in docs -- https://master.php.net/note/delete/96265/in+docs Del: other reasons-- https://master.php.net/note/delete/96265 Reject -- https://master.php.net/note/reject/96265 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#166091) next »