ODBC Driver for Anaplan

Build 26.0.9655

Parameterized Statements

The following code example shows how to bind parameters to create parameterized statements.

Reusable Statements

The odbc_prepare function creates prepared statements, which can be re-used across multiple calls to odbc_execute. The statement object can be used to fetch results like a non-parameterized query.

$stmt = odbc_prepare($cnx, "SELECT Region, Product FROM [Workspace].[Model].[Sales] WHERE Value = ?");

odbc_execute($stmt, array("100 1"));
while ($row = odbc_fetch_array($stmt)) {
    echo "Region = ", $row["Region"], "\n";
    echo "Product = ", $row["Product"], "\n";
}

odbc_execute($stmt, array("100 2"));
while ($row = odbc_fetch_array($stmt)) {
    echo "Region = ", $row["Region"], "\n";
    echo "Product = ", $row["Product"], "\n";
}

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 26.0.9655