Home > Archive > PHP DB > January 2007 > Re: [PHP-DB] php using odbc
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: [PHP-DB] php using odbc
|
|
|
|
look this as one example of MSAccess connection:
--------
<?
$sDefaultDir = 'C:\apache\htdocs\MDB'; // path dir MDB
$sMDBfile = "cop.mdb"; // MSaccess database name
$sMDBpathAndFilename = $sDefaultDir.'\'.$sMDBfile; // concatenate
// define dsn
$sCfg_dsn = "DRIVER=Microsoft Access Driver (*.mdb);
DBQ=$sMDBpathAndFilename;
UserCommitSync=Yes;
Threads=3;
SafeTransactions=0;
PageTimeout=5;
MaxScanRows=8;
MaxBufferSize=2048;
DriverId=281;
DefaultDir=$sDefaultDir";
// if you need login and pass
$sCfg_dsn_login = "";
$sCfg_dsn_mdp = "";
$hConn = odbc_connect( $sCfg_dsn, $sCfg_dsn_login, $sCfg_dsn_mdp ) or
die( "Not connection." );
$sql = "select * from table";
$result= odbc_exec($hConn,$sql);
while(odbc_fetch_row($result))
{
$db_field1 = odbc_result($result,"field_name");
}
?>
----------------
check rest of odbc function in php manual.
bye,
you wrote:
> can u help me?
> 1.i wanna build a connection using odbc but i don't have any example.
> what url can i visit?
> 2. odbc i want to connect was on this url.. plz view to help me.
> http://indoupload.net/files/view/803/odbc%20problem.jpg
| |
|
| thx for your info and example
i hope i can use the link i gave in previous message
i want to connect to there
----- Original Message -----
From: "Vic" <sysvic@gmail.com>
To: <php-db@lists.php.net>
Sent: Saturday, January 27, 2007 9:44 AM
Subject: Re: [PHP-DB] php using odbc
>
> look this as one example of MSAccess connection:
>
> --------
> <?
> $sDefaultDir = 'C:\apache\htdocs\MDB'; // path dir MDB
> $sMDBfile = "cop.mdb"; // MSaccess database name
>
> $sMDBpathAndFilename = $sDefaultDir.'\'.$sMDBfile; // concatenate
>
> // define dsn
> $sCfg_dsn = "DRIVER=Microsoft Access Driver (*.mdb);
> DBQ=$sMDBpathAndFilename;
> UserCommitSync=Yes;
> Threads=3;
> SafeTransactions=0;
> PageTimeout=5;
> MaxScanRows=8;
> MaxBufferSize=2048;
> DriverId=281;
> DefaultDir=$sDefaultDir";
>
> // if you need login and pass
> $sCfg_dsn_login = "";
> $sCfg_dsn_mdp = "";
>
>
> $hConn = odbc_connect( $sCfg_dsn, $sCfg_dsn_login, $sCfg_dsn_mdp ) or
> die( "Not connection." );
>
> $sql = "select * from table";
> $result= odbc_exec($hConn,$sql);
>
> while(odbc_fetch_row($result))
> {
> $db_field1 = odbc_result($result,"field_name");
> }
>
> ?>
> ----------------
>
> check rest of odbc function in php manual.
>
> bye,
>
>
>
>
> you wrote:
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
|
|
|
|
|