RE: [PHP-DB] Need simple example for making an odbc connection

From: Date: Tue, 26 Oct 2004 03:23:20 +0000
Subject: RE: [PHP-DB] Need simple example for making an odbc connection
Groups: php.db 
Request: Send a blank email to php-db+get-37022@lists.php.net to get a copy of this message
here is an access one <HTML> <HEAD> </HEAD> <BODY> <?php
     // Program to test connecting to a Microsoft Access ODBC Data Source
     $connection = odbc_connect("postcard", "", "");
     print "Connected to datasource<BR><BR>";
     //$sql="SELECT * FROM postcard";
     $sql="insert into postcard (sendername, senderemail, receipt, receiptemail)
           values ('bka', 'bntkoert@aol.com', 'bastien', 'bastien@bastienkoert.com')";
     if ($result = odbc_exec($connection, $sql))
       print "Command executed successfully<BR><BR>";
     else
       print "Error while executing command<BR><BR>";
     /*
     // Print results
     while(odbc_fetch_row($result))
       print odbc_result($result, 1) . "   " . odbc_result($result, 2) . "   " . odbc_result($result, 3) . "   " . odbc_result($result, 4) . "   " . odbc_result($result, 5) . "<BR>";
     */
     odbc_close($connection);
     print "<BR>Connection closed.";
?> </BODY> </HTML> bastien
From: "tom mccord" <tom.mccord@supremecorp.com> To: php-db@lists.php.net Subject: [PHP-DB] Need simple example for making an odbc connection Date: Mon, 25 Oct 2004 15:07:48 -0500 I am very new to php and I need a simple example for connecting and retrieving from an odbc connection. The code I am maintaining currently accesses MySql using the built in functions for it, but I need to access DB2 and Access databases. Thanks - Tom -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#37022) next »