database connection problems
Posted: Fri Jun 14, 2002 4:22 am
when i try to connect to the access db thru odbc, it gives the error msg:
"Warning: odbc_result_all(): supplied argument is not a valid ODBC result resource in C:\Program Files\Apache Group\Apache2\htdocs\test1.php on line 9
Warning: odbc_free_result(): supplied argument is not a valid ODBC result resource in C:\Program Files\Apache Group\Apache2\htdocs\test1.php on line 10"
for you information, i'm using php 4.2.1.
and i didn't change anythings in php.ini file.
below is the code of the php page:-
<?php
$connection = odbc_connect("webdb","","") or die ("Couldn't connect to the datasource.");
// create SQL statement
$sql = "select custcode, custname, birthdate from table1";
$sql_statement = odbc_prepare($connection,$sql) or die ("Couldn't prepare statement.");
$sql_result = odbc_execute($sql_statement) or die ("Couldn't execute query.");
odbc_result_all($sql_result, "border=1");
odbc_free_result($sql_result);
odbc_close($connection);
?>
PLEASE HELP!!
Thanks!!
"Warning: odbc_result_all(): supplied argument is not a valid ODBC result resource in C:\Program Files\Apache Group\Apache2\htdocs\test1.php on line 9
Warning: odbc_free_result(): supplied argument is not a valid ODBC result resource in C:\Program Files\Apache Group\Apache2\htdocs\test1.php on line 10"
for you information, i'm using php 4.2.1.
and i didn't change anythings in php.ini file.
below is the code of the php page:-
<?php
$connection = odbc_connect("webdb","","") or die ("Couldn't connect to the datasource.");
// create SQL statement
$sql = "select custcode, custname, birthdate from table1";
$sql_statement = odbc_prepare($connection,$sql) or die ("Couldn't prepare statement.");
$sql_result = odbc_execute($sql_statement) or die ("Couldn't execute query.");
odbc_result_all($sql_result, "border=1");
odbc_free_result($sql_result);
odbc_close($connection);
?>
PLEASE HELP!!
Thanks!!