Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 14th, 2008, 06:16 AM
Authorized User
 
Join Date: Apr 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Inserting data into MS_ACCESS in PHP

Hi,

I am new to PHP, i got how to connect to the MS-ACCESS Database and retrieving data, but when i try to insert it is giving some error message.
How resove it? Can any one help out......?

 
Old June 25th, 2008, 03:38 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hi,
here is the basic connection code

<?php
$db_conn = new COM("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("./Northwind.mdb").";";
$db_conn->open($connstr);
$rS = $db_conn->execute("SELECT * FROM Employees");
$f1 = $rS->Fields(0);
$f2 = $rS->Fields(1);
while (!$rS->EOF)
{
    print $f1->value." ".$f2->value."<br />\n";
    $rS->MoveNext();
}
$rS->Close();
$db_conn->Close();
?>

surendran
(Anything is Possible)
http://ssuren.spaces.msn.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
inserting data stevens ADO.NET 0 May 13th, 2008 07:49 AM
mysql/php inserting into a table mark jonas Beginning PHP 1 February 25th, 2007 05:54 AM
Data inserting twice nuttylife2 ASP.NET 2.0 Professional 8 August 22nd, 2006 11:01 AM
Inserting data when data already exsist desireemm SQL Language 0 January 16th, 2006 11:01 PM
inserting into oracle using php cblake PHP Databases 1 May 26th, 2005 03:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.