we are using php+sqlserver with stored procedures in a project. our customer wants to put another server(lets say X server) between our application and database server. we will send requests to X and it will connect to DB and will return data to application. right now we are using 2 functions. db_request (it has sqlsrv_request) and db_fetch (it has sqlsvr_fetch_array). for example, when we select some cities, we are calling select_user_by_city procedure.
$req = db_request("select_user_by_city",array("city_id"=>1));
while($result=db_fetch($req)){blablabla}
and my problem begins on this point. i changed inside of db_request function and add some curl and json code in it. its sends the request to X server. X server calling sqlsrv_request and selecting data and returning data as json again. im converting json to array in db_fetch function in application server. but when it proceed to while loop, its going infinite loop. because returning data is not resource anymore, its an array.
is there anyway to make this thing work without change all while's to foreach ?