I have a prepared statement built inside a class:
function reader($ser)
{
$pstmt=odbc_prepare($this->conn,'SELECT TOP 1 "name"
FROM '.$this->table.' WHERE
"surname" LIKE ? ');
return odbc_execute($pstmt,array("$ser"));
}
And gets its $ser through a post
$serTab=$product->reader($ser);
Example $ser :
$ser=' '3221252'';
When it comes to displaying values these functions return nothing (but they are working with odbc_exec):
while(odbc_fetch_row($serTab))
{
for($i=1;$i<=odbc_num_fields($serTab);$i++)
{
echo odbc_result($serTab,$i);
}
}
Are there any alternatives for these functions? Why it doesn’t return anything with obdc_execute?How do I fix this?
Can’t use PDO because of this error:
Conversion of parameter/column (5) from data type NVARCHAR to ASCII
failed
I have no authorization to make changes on database, hence on data types.DBMS: SAP Hana
2
Answers
fixed it by adding
before
and changed
to
odbc_execute
just returns a boolean to indicatesuccess or failure. What you need to return is
$pstmt
: