Querys with udfs in where
Posted: Fri Dec 13, 2002 2:06 pm
Hi, i have a problem with the next source:
<?php
function Funcion1($pParametro)
{ $Con1 = odbc_connect("Datos","","");
$Query = "SELECT dato FROM tabla1 WHERE id=".$pParametro;
$Resul = @odbc_exec($Con1,$Query);
// @odbc_result_all($Resul, "BGCOLOR='#AAFFAA' border=3 width=30%");
return @odbc_result($Resul,1);
odbc_close($Con1);
};
$Conn = odbc_connect("Datos","","");
$Consulta = "SELECT * FROM tabla WHERE id=13875 and campo1=Funcion1(1300)";
$Resultado = @odbc_exec($Conn,$Consulta);
@odbc_result_all($Resultado, "BGCOLOR='#AAFFAA' border=3 width=30%");
odbc_close($Conn);
?>
I connect with Visual Fox tables via ODBC, and I execute the script and nothing is returned, i think that the function Funcion1() does not execute int the query, but i test the same function and it is working OK. I can't to migrate to another DataBase (MySQL for example).
If there's somebody who understanding me, please respond, and sorry for my english.
Rubén.
<?php
function Funcion1($pParametro)
{ $Con1 = odbc_connect("Datos","","");
$Query = "SELECT dato FROM tabla1 WHERE id=".$pParametro;
$Resul = @odbc_exec($Con1,$Query);
// @odbc_result_all($Resul, "BGCOLOR='#AAFFAA' border=3 width=30%");
return @odbc_result($Resul,1);
odbc_close($Con1);
};
$Conn = odbc_connect("Datos","","");
$Consulta = "SELECT * FROM tabla WHERE id=13875 and campo1=Funcion1(1300)";
$Resultado = @odbc_exec($Conn,$Consulta);
@odbc_result_all($Resultado, "BGCOLOR='#AAFFAA' border=3 width=30%");
odbc_close($Conn);
?>
I connect with Visual Fox tables via ODBC, and I execute the script and nothing is returned, i think that the function Funcion1() does not execute int the query, but i test the same function and it is working OK. I can't to migrate to another DataBase (MySQL for example).
If there's somebody who understanding me, please respond, and sorry for my english.
Rubén.