使用PHP中的参数调用SQL FUNCTION

I have a question. I would call a SQL function through PHP language.

EX. "SELECT * FROM dbo.openday_detail(eventID)"

I was trying this:

        $eventID= 10000;

        $params="@eventID int";
        $paramslist="@eventID='$eventID'";
        $sql = "SELECT * FROM dbo.openday_detail(eventID = @eventID)";
        $dbsql = "EXEC sp_executesql 
            N'$sql', 
                N'$params',
                $paramslist";

        $result=mssql_query($dbsql,$link);

But it doesn't work.

Thanks!

You cannot pas an assignment inside the call to the procedure... try removing eventID = and be sure your @eventID is correctly initialized

I tried to insert directly the INT value, but it doesn't work...

I guess that the problem is the Table-Function...andI can't to access to DB to see/modify the function .

a workaround?

I think the correct statement would be :

 $sql = "SELECT * FROM dbo.openday_detail(@eventID)";

or

 $sql = "SELECT * FROM dbo.openday_detail("+ $eventID+")";