RE: Need simple example for making an odbc connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx', 'bastien', 'bastien@xxxxxxxxxxxxxxxx')";


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@xxxxxxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject:  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


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux