Tools (all 64 bits):
PHP 7.3.5
ODBC
SQL Base 12.3
I'm trying to fetch results from a query that have parameters, using PDOStatement, but nothing returns and no error occurs.
Does anyone know if there is support for parametrized queries with PHP + ODBC + SQLBase?
CODE THAT DOESN'T WORK:
Code: Select all
<?php
$pdo = new PDO("odbc:DSN", "user", "password");
$query = "
SELECT column
FROM table
WHERE column = ?
";
$search = "term";
$statement = $pdo->prepare($query);
$statement->bindParam(1, $search);
$statement->execute();
$result = $statement->fetchAll(\PDO::FETCH_ASSOC);
var_dump($result); // returns an empty array
$pdo->errorInfo()
Code: Select all
Array
(
[0] => 00000
[1] =>
[2] =>
)
$statement->errorInfo()
Code: Select all
Array
(
[0] => 00000
[1] => 0
[2] => ((null)[0] at (null):0)
[3] =>
)
$statement->debugDumpParams()
Code: Select all
SQL: [70]
SELECT column
FROM table
WHERE column = ?
Params: 1
Key: Position #0:
paramno=0
name=[0] ""
is_param=1
param_type=2
Code: Select all
<?php
$pdo = new PDO("odbc:DSN", "user", "password");
$query = "
SELECT column
FROM table
WHERE column = 'term'
";
$statement = $pdo->prepare($query);
$statement->execute();
$result = $statement->fetchAll(\PDO::FETCH_ASSOC);
var_dump($result); // return all data from table.column
SIDE NOTE:
I'm able to run Prepared Statement with parameters using C# + ODBC + SQLBase and Java + JDBC + SQLBase.
Thanks in advance!