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
fixed it by adding
$ser=str_replace(array("'", "\'"," "),"",$ser)
before
odbc_prepare
and changed
return odbc_execute($pstmt,array("$ser"));
to
return odbc_execute($pstmt,array($ser));