By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,414 Members | 1,024 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,414 IT Pros & Developers. It's quick & easy.

cant connect php to access via odbc over network

P: 1
hi there

Im going nuts - any help appreciated

trying to connect to access db over a network

so far -
I can connect to the db using the same odbc with excel
I can connect to a copy of the db using a similar odbc on a local drive with php

I just cant connect to it over the network - is this a permissions thing possibly??
the error I get is:
Warning: odbc_connect() [function.odbc-connect]: SQL error: , SQL state 00000 in SQLConnect

code below:

$testdb = odbc_connect('testMWL', '','' );
$sql2 = "select * from COMPANY";
$rs2 = odbc_exec($testdb,$sql2);
if (!$rs2)die(odbc_error());

while($data2 = odbc_fetch_array($rs2)){
echo etc etc
}


thanks in advance
yodboy
Dec 27 '06 #1
Share this Question
Share on Google+
2 Replies


P: 51
save the file as odbc.php

[PHP]<? $odbc = odbc_connect ('dbname','dbusername,' 'dbpass' ) or die('Could Not Connect to ODBC Database!');
if (function_exists(odbc_fetch_array))
return; ?>
[/PHP]

insert.php file

[PHP]
<?
include('odbc.php');
$qryStr = "INSERT INTO table_name(......) VALUES(.....);
odbc_exec($odbc, $qryStr)or die (odbc_errormsg());
odbc_close($odbc);
?>
[/PHP]
Dec 27 '06 #2

P: 51
save the file as odbc.php

[PHP]<? $odbc = odbc_connect ('dbname','dbusername,' 'dbpass' ) or die('Could Not Connect to ODBC Database!');
if (function_exists(odbc_fetch_array))
return; ?>
[/PHP]

insert.php file

[PHP]
<?
include('odbc.php');
$qryStr = "INSERT INTO table_name(......) VALUES(.....);
odbc_exec($odbc, $qryStr)or die (odbc_errormsg());
odbc_close($odbc);
?>
[/PHP]

sorry i left few codes

[PHP]
<?
include("odbc.php");
$sql="SELECT * FROM table_name";
$result=odbc_exec($odbc,$sql);

//echo "<TABLE border=1 align = 'center'>";

//echo"<TR bgcolor = '#999999'><TD><B>Heading1</B><td>Heading2</td></TR>";
while ($myrow = odbc_fetch_array($result))
{
//echo "<TR><TD>";
echo $myrow["feild_name1"];
//echo"<td>";
echo "$nbsp $nbsp $nbsp";
echo $myrow["feild_name2"];
//echo "</tr>";


}
//echo "</TABLE>";
?>
[/PHP]
Dec 27 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.