Insert in multiple relative tables
<p>I have two tables:
<strong>eventcategory</strong>
<img src="http://i.stack.imgur.com/PUh3T.png" alt="enter image description here"></p>

<p><strong>initplayer</strong>
<img src="http://i.stack.imgur.com/xD3Iu.png" alt="enter image description here"></p>

<p>What i want is to insert the table initplayer.</p>

<p>In order to do that:
    First, i return a query and create an associate array</p>

<p>$dbResult = mysql_query("select * from eventcategory");</p>

<pre><code>function array_push_assoc($array, $key, $value){
$array[$key] = $value;
return $array;
}

$arrEventCategory = array();
while ($info = mysql_fetch_array($dbResult)) {
    $arrEventCategory = array_push_assoc($arrEventCategory,$info['id'],$info['eventCategory']);

}
print_r($arrEventCategory);





$ga-&gt;requestAccountData();
foreach($ga-&gt;getResults() as $result)
{

   $ga-&gt;requestReportData('30191592', array('eventCategory', 'eventAction'), array('totalEvents'), $sort_metric = null, $filter = 'eventAction==InitPlayer', $start_date = $startDate, $end_date = $startDate);
   foreach($ga-&gt;getResults() as $result2)
   {       
       $key = array_search($result2-&gt;geteventCategory(), $arrEventCategory);
       $mysql-&gt;query("insert into initplayer values(" . $result-&gt;getProfileId() . ",'" . $result . "','".$result2-&gt;gettotalEvents()."','".$startDate."',".$key.")");
   }

}
</code></pre>

<p><img src="http://i.stack.imgur.com/4PuBu.png" alt="enter image description here"></p>

<p>What i want to do to insert db id's according to eventCategory :S</p>
