How to set variables from array data in dialplan

Hello,

I am having asterisk-1.6.2.22 on my CentOS system.

I want to call the phpagi script to fetch the data from the database.
When there is one row, my php script is fetching the data properly. I can set the agi variables and the dialplan works proper.
But when there are more than one rows, the PHP script is properly fetching the data. But I m getting issues, when I try to set the agi variables using agi->set_variable().

Below is my tracking.php

[quote]<?php

// create a connection to the local host mono .NET pull back the wsdl to get the functions names
// and also the parameters and return values

$client = new SoapClient(“http://127.0.0.1:83/Service.asmx?WSDL”,
array(
“trace” => 1, // enable trace to view what is happening
"exceptions" => 0, // disable exceptions
"cache_wsdl" => 0) // disable any caching on the wsdl, encase you alter the wsdl server
);

// fetch the work no parameters.
$tech_code=101;
$work_no=51;
$phone_num=1000;
$return_type=1;

$webService=$client->GetData(array(“tech_code” => $tech_code,“work_no” => $work_no,“return_type” => $return_type,“phone_number” => $phone_num ));

$json=$webService->GetDataResult;
$test=json_decode($json, true);

echo “

”;
print_r($test);
echo “
”;

for($i=0;$i<count($test);$i++)
{
$temp;
echo “\n”;
echo $item_description=$test[$i][‘item_description’];
echo “
”;

//$agi->SET_VARIABLE('tech_code', $test[$i]['tech_code']);
//$agi->SET_VARIABLE('work_no', $test[$i]['work_no']);

$temp = $test[$i]['item_no'];
echo "=================" . $temp;
$agi->set_variable('item_no', $temp);

}
?>
[/quote]

And the extensions.conf :

Error :

-Urmi