PHP5/SQL Server 2005/IIS/Windows 2003/ADODB

When I call the stored procedure (listed below) it doesn't return the output variables. If I execute it in SQL Management Studio, it works fine there.

Can you please tell me what am I doing wrong

Table Structure (Changing structure is not an option as it's already in production)
Code:
ID
ID_PARENT
NAME
BREADCRUMB_ID  (IDs seperated with ",")
BREADCRUMB_NAME (NAMEs seperated with " > ")
Stored Procedure
Code:
------------------------------------------
IF OBJECT_ID('[spZZ_BREADCRUMB_ANCESTRY]') IS NOT NULL
	DROP PROCEDURE [spZZ_BREADCRUMB_ANCESTRY]
GO
CREATE PROCEDURE [dbo].[spZZ_BREADCRUMB_ANCESTRY]
	@ID				INT					= 0,
	@TABLE_NAME		VARCHAR(100)		= '',
	@FIELD_ID			VARCHAR(50)		= '[ID]',
	@FIELD_NAME		VARCHAR(50)		= '[NAME]',
	@FIELD_ID_PARENT	VARCHAR(50)		= '[ID_PARENT]',
	@BREADCRUMB_ID		VARCHAR(8000)		OUTPUT,
	@BREADCRUMB_NAME	VARCHAR(8000)		OUTPUT
AS
BEGIN
	
	--Access the parent of the ID value provided
	--Returns Breadcrumb ID and Breadcrumb Name list as String
	--Does the while loop rather than cursor.
	--Normally to be called via spZZ_BREADCRUMB_GENERATE Stored Procedure
	
	SET @BREADCRUMB_ID = '';
	SET @BREADCRUMB_NAME = '';
	
	
	DECLARE @SELECT NVARCHAR(1000);
	DECLARE @PARAM NVARCHAR(1000);
	
	DECLARE @ID_PARENT_TEMP INT;
	DECLARE @ID_TEMP VARCHAR(1000);
	DECLARE @NAME_TEMP VARCHAR(1000);
	
	DECLARE @FLAG_SKIP	INT;
	SET @FLAG_SKIP = 1;--If TRUE then will skip the first record in WHILE loop because we don't want to add ID itself in the breadcrumb
	
	SET NOCOUNT ON;
	
	
	
		
	
	WHILE @ID<>0
	 BEGIN
		SET @SELECT = N'SELECT @ID_PARENT_TEMP=' + @FIELD_ID_PARENT +
						 ' ,@ID_TEMP=(CAST(' + @FIELD_ID + ' AS VARCHAR)) ' + 
						 ' ,@NAME_TEMP=(' + @FIELD_NAME + ' ) 
			FROM ' + @TABLE_NAME + '
			WHERE ' + @FIELD_ID + '=' + CONVERT(VARCHAR(255),@ID) + '
			ORDER BY NAME'
		SET @PARAM = N'@ID	INT, @TABLE_NAME VARCHAR(100), @FIELD_ID VARCHAR(50), @FIELD_ID_PARENT VARCHAR(50), @FIELD_NAME VARCHAR(50),@ID_PARENT_TEMP INT OUTPUT,@ID_TEMP VARCHAR(1000) OUTPUT, @NAME_TEMP VARCHAR(1000) OUTPUT'
		
		
		EXECUTE sp_executeSQL @SELECT,@PARAM,@ID,@TABLE_NAME,@FIELD_ID,@FIELD_ID_PARENT,@FIELD_NAME,@ID_PARENT_TEMP OUTPUT,@ID_TEMP OUTPUT,@NAME_TEMP OUTPUT

		SELECT @ID_PARENT_TEMP
		SELECT @ID_TEMP
		SELECT @NAME_TEMP
				
		SET @ID=@ID_PARENT_TEMP
		
		if(@@ROWCOUNT > 0 and @FLAG_SKIP<>1)
			BEGIN
				SET @BREADCRUMB_ID = @ID_TEMP + ',' + @BREADCRUMB_ID
				SET @BREADCRUMB_NAME = @NAME_TEMP + ' > ' + @BREADCRUMB_NAME
			END
		
		--Set @FLAG_SKIP =0 after firest record has been searched. Parent records should be added in the breadcrumb
		SET @FLAG_SKIP = 0
		
   	END
END
GO
I am calling it with PHP like this
PHP Code:
private function __get_ancestry($id,$tableName,$fieldId,$fieldName,$fieldIdParent)
        {
            
$breadcrumbId $breadccrumbName '';
            
$arr = array();

            
$conn =& $this->CORE->db->conn;

            
$id = (int) $id;
            
$tableName = (string)$tableName;
            
$fieldId = (string)$fieldId;
            
$fieldName = (string)$fieldName;
            
$fieldIdParent = (string)$fieldIdParent;
            
            
$sql $conn->PrepareSP($this->CORE->settings->get_setting('sp_ZZ_BREADCRUMB_ANCESTRY'));
            
            
$conn->InParameter($sql,$id,'ID');
            
$conn->InParameter($sql,$tableName,'TABLE_NAME');
            
$conn->InParameter($sql,$fieldId,'FIELD_ID');
            
$conn->InParameter($sql,$fieldName,'FIELD_NAME');
            
$conn->InParameter($sql,$fieldIdParent,'FIELD_ID_PARENT');
            
$conn->OutParameter($sql,$breadcrumbId,'BREADCRUMB_ID');
            
$conn->OutParameter($sql,$breadcrumbName,'BREADCRUMB_NAME');
            
            
$rs $conn->Execute($sql);
            
            
            
$arr['BREADCRUMB_ID'] = $breadcrumbId//EMPTY
            
$arr['BREADCRUMB_NAME'] = $breadcrumbName//EMPTY

            
return $arr;
        } 


OUTPUT from Debug and print_r is
Code:
InParameter($stmt, $php_var='416', $name='ID', $maxLen=4000, $type=56);
InParameter($stmt, $php_var='CS_CASES', $name='TABLE_NAME', $maxLen=4000, $type=47);
InParameter($stmt, $php_var='[ID]', $name='FIELD_ID', $maxLen=4000, $type=47);
InParameter($stmt, $php_var='[NAME]', $name='FIELD_NAME', $maxLen=4000, $type=47);
InParameter($stmt, $php_var='[ID_PARENT]', $name='FIELD_ID_PARENT', $maxLen=4000, $type=47);
OutParameter($stmt, $php_var='', $name='BREADCRUMB_ID', $maxLen=4000, $type=47);
OutParameter($stmt, $php_var='', $name='BREADCRUMB_NAME', $maxLen=4000, $type=47);
(mssql): [spZZ_BREADCRUMB_ANCESTRY]  

Array
(
    [computed] => 114
)
Thanks