Page 1 of 1

php function

Posted: Thu Feb 02, 2012 10:08 pm
by dpkdn
hi ...
I am doing a php function in which i am selecting records which are atleast 50 from a table which having one column as strings..
and for each of these string name there are tables in database
so i am passing these strings to a function in while loop...
the function does add the data into these tables...
but problem is that its not adding to all 50 tables it only adds 3 to 4 tables..
I am posting my code here...pls help me... :banghead:

Code: Select all

<?php
$i=0;
$username = "test"; 
$auth = 'test1234';
$con = mssql_connect ('server ', $username, $auth) or die ('MsSQL connect failed. ' . mssql_error());
mssql_select_db(test11) or die('Cannot select database. ' . mssql_error());

function doWebService($temp)
{
	   ########################################################################
       # Do some SOAP / Call a Web Service
       $client = new SoapClient("http://domain.com/service.asmx?WSDL");
       $strWeather = $client->AddSymbolDetails(array('symbol' => $temp))->AddSymbolDetailsResult;
       echo $strWeather . "\nDone";
}

$query = mssql_query('SELECT Symbol FROM MasterTable');
ini_set('max_execution_time', 500); //300 seconds = 5 minutes

while($row = mssql_fetch_array($query, MSSQL_NUM))
{
foreach($row as $value) 
    { 
	doWebService($value);
   echo $value; 
   $i++;
    } 
	
}
echo $i;
mssql_free_result($query);
?>

Re: php function

Posted: Fri Feb 03, 2012 1:29 am
by Christopher
You understand that your function is recursive? It is calling itself infinitely. It's probably just timing out.

Re: php function

Posted: Fri Feb 03, 2012 10:08 pm
by dpkdn
firstly thnx for ur reply..
my problem is solved ...
its the web service was located on remote comp...
i changed the location of it to my host then its done........