How to merge some fields of second array into first array after comparing the values of keys common in both arrays? [on hold]

My question sounds bit confusing but actually it's simple. Let me describe you the scenario first. I've two arrays viz. $al and $count. Both the arrays generate dynamically depending on the user input. So for instance I'm printing below the contents of both of these arrays:

    while ($i<=10) {     $al1=mysql_query("SELECT * FROM `apt1` WHERE `idapt`='$id'  AND `birinikin1`=".$i."");     $al[]=mysql_fetch_array($al1);     $count=mysql_num_rows($al1);     $count2[]=$count;     $i++;     }     echo "<pre>"  ; print_r($al); echo "<pre>"; print_r($count2); echo "<pre>"; exit();  Array (     [0] =>      [1] => Array         (             [0] => 147             [id1] => 147             [1] => 2016-07-29             [tarix1] => 2016-07-29             [2] => 2             [birinikin1] => 2             [3] => ahmet can             [adsoyad1] => ahmet can             [4] => Kishi             [cins1] => Kishi             [5] => 19.04.1993             [dogil1] => 19.04.1993             [6] => trabzon             [unvan1] => trabzon             [7] => avea             [ishyeri1] => avea             [8] => cncnc             [diaqnoz1] => cncnc             [9] => cnncc             [mualice1] => cnncc             [10] => nccnc             [qeyd1] => nccnc             [11] => 62             [idapt] => 62         )      [2] => Array         (             [0] => 148             [id1] => 148             [1] => 2016-07-30             [tarix1] => 2016-07-30             [2] => 3             [birinikin1] => 3             [3] => ahmet can             [adsoyad1] => ahmet can             [4] => Kishi             [cins1] => Kishi             [5] => 19.04.1993             [dogil1] => 19.04.1993             [6] => trabzon             [unvan1] => trabzon             [7] => avea             [ishyeri1] => avea             [8] => ttt             [diaqnoz1] => ttt             [9] => ttt             [mualice1] => ttt             [10] => ttt             [qeyd1] => ttt             [11] => 62             [idapt] => 62         )      [3] =>      [4] =>      [5] =>      [6] =>      [7] =>      [8] =>      [9] =>  )    Array (     [0] => 0     [1] => 1     [2] => 1     [3] => 0     [4] => 0     [5] => 0     [6] => 0     [7] => 0     [8] => 0     [9] => 0 ) 

Now what I want to achieve is:

Array (     [0] =>      [1] => Array         (             [0] => 147             [id1] => 147             [1] => 2016-07-29             [tarix1] => 2016-07-29             [2] => 2             [birinikin1] => 2             [3] => ahmet can             [adsoyad1] => ahmet can             [4] => Kishi             [cins1] => Kishi             [5] => 19.04.1993             [dogil1] => 19.04.1993             [6] => trabzon             [unvan1] => trabzon             [7] => avea             [ishyeri1] => avea             [8] => cncnc             [diaqnoz1] => cncnc             [9] => cnncc             [mualice1] => cnncc             [10] => nccnc             [qeyd1] => nccnc             [11] => 62             [idapt] => 62             [12] => 1         )      [2] => Array         (             [0] => 148             [id1] => 148             [1] => 2016-07-30             [tarix1] => 2016-07-30             [2] => 3             [birinikin1] => 3             [3] => ahmet can             [adsoyad1] => ahmet can             [4] => Kishi             [cins1] => Kishi             [5] => 19.04.1993             [dogil1] => 19.04.1993             [6] => trabzon             [unvan1] => trabzon             [7] => avea             [ishyeri1] => avea             [8] => ttt             [diaqnoz1] => ttt             [9] => ttt             [mualice1] => ttt             [10] => ttt             [qeyd1] => ttt             [11] => 62             [idapt] => 62             [12] => 1 )      [3] =>      [4] =>      [5] =>      [6] =>      [7] =>      [8] =>      [9] =>  ) 

Replay

Category: php Time: 2016-07-30 Views: 0
Tags: php

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.123 (s). 12 q(s)