AnsweredAssumed Answered

FileMaker Server

Question asked by NickNick on Dec 10, 2013
Latest reply on May 12, 2015 by TSGal

Product

FileMaker Server

Version

12v3

Operating system version

Windows 7 32 bit

Description of the issue

I've tried to use php odbc to connect to filemaker database
with the following piece of code:

$server = ;
$database = " $user = "";
$password = "";

$connection = odbc_connect("Driver=FileMaker ODBC;Server=$server;Database=$database;", $user, $password);
$sql = "SELECT FROM

WHERE = ?";

$cond = ;

$statement = odbc_prepare($connection, $sql);

if(!$statement) {
  die("could not prepare statement ".$statement);
}
$resultSet = odbc_execute($statement, array($cond));

odbc_close($connection);

but this row:
$resultSet = odbc_execute($statement, array($cond));

give the following error:

Warning: odbc_execute() [function.odbc-execute]: SQL error: [FileMaker][FileMaker] No cursor open for statement, SQL state HY000 in SQLFreeStmt in test.php

obviously this problem is the same if avoid the paramaters, but not the odbc_prepare because is necessary

i saw the source of odbc_execute() from here:
http://pr-web-01.qatar.cmu.edu/src/php-5.2.6/ext/odbc/php_odbc.c

and saw that the problem was connected with this instruction:
     /* Close cursor, needed for doing multiple selects */
     rc = SQLFreeStmt(result->stmt, SQL_CLOSE);

Could you help me to solve?

Outcomes