在所有值作为键,值对传入后执行函数(Web服务)

I have two tables:

Table 1(t1):

column=> id, t1.col1, t1.col2, t1.col3
values=>  1, v1, v2, v3

Table 2(t2):

column=> t1_id, t2.col1, t2.col2
values=> 1, val1, val2
         1, val3, val4
         1, val5, val6

I am executing a function(WebService) which takes in key, value pairs(as parameters) in an array For example:

array(array("Key" => val1,
            "value" => val2),
      array("key" => val3,
            "value" => val4))

I want to do the same by getting the values from the database that is table 2. So, What I did is, fetched the key, value pairs from the data base and stored it as $key, and & $value. Now the function looks like:

 array(array("Key" => $key,
            "value" => $value))

when I run this, Instead of taking all the key, value pairs and executing after, The function is executing for each key, value pair.

I want to execute the function only all the key, value pairs are in the array.