Duyuruyu Kapat
Facebook Gözat
Twitter Gözat

PHP veri birleştirme

Konu, 'PHP' kısmında koboy tarafından paylaşıldı.

  1. koboy

    koboy Üye

    Kayıt:
    5 Ocak 2012
    Mesajlar:
    191
    Beğenilen Mesajlar:
    1
    Merhabalar aşağıda resim ve kodları koydum yapmak istediğimi umarım anlatabilmisimdir.



    PHP:
    <div>
                                                <table id="dynamic-table" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%" >
                                                          <thead>
                                             
                                                                           
                           
                                                                    <tr>
                                                            <th  class="filterhead ">Mükellef Adı</th>
                                                                                             
                                                             <th   class="filterhead">Aylık Kdv</th>
                                                         
                                                       <th class="hidden-480">A Kdv Ocak</th>
                                                        </tr>
                             
                                                     
                                 
                                                        <tr>
                                                            <th class="hidden-480">Mükellef Adı</th>
                                                                                               
                                                            <th class="hidden-480">Aylık Kdv Ocak</th>
                                                               <th class="hidden-480">Muhtasar</th>
                               
                                                       
                                                    <th class="hidden-480">Muhtasar</th>
                                               
                                                       
                                                    </thead>

                       

                                                    <tbody>
                                                   
                                                   
                                             
                           
         
                                                   


           <?php
                                                                                       

    $sql 
    mysql_query("

    SELECT * FROM  erman_beyanname LEFT OUTER JOIN  erman_kullanicilar  ON    erman_beyanname.mukellef_id = erman_kullanicilar.id

         


    "
    );
       

    while (
    $row mysql_fetch_array($sql)){
        
    ?>

       
         
         
                                                   
                                                        <tr>
                                   
    <td><?=$row[kullanici_adi];?></td>
                                               
    <td><?=$row[id];?></td>                                                                                                               
    <?php

    if($row[beyanname_turu]== 'kdv_aylik' &&  ($row[beyanname_ay]==)) {   
        echo
    '<td class="hidden-480" ><span class="btn-xs btn-success" style=" padding-left: 20px;padding-right: 20px;"><i class="ace-icon fa fa-check"></i>Verildi</span></td>';

    }



    else {

    echo
    '<td class="hidden-480" ><span  data-rel="popover" data-trigger="hover" data-content="Beyanname verilmeyecek" class="btn-xs btn-danger" style="  padding-left: 20px;padding-right: 20px;" ><i class="ace-icon fa fa-times "></i>Hayır</span></td>';


    }


    ?> 
             
       
                                                                                                                   
    <?php

    if($row[beyanname_turu]== 'muhtasar_aylik' &&  ($row[beyanname_ay]==)) {   
        echo
    '<td class="hidden-480" ><span class="btn-xs btn-success" style=" padding-left: 20px;padding-right: 20px;"><i class="ace-icon fa fa-check"></i>Verildi</span></td>';

    }


    else {

    echo
    '<td class="hidden-480" ><span  data-rel="popover" data-trigger="hover" data-content="Beyanname verilmeyecek" class="btn-xs btn-danger" style="  padding-left: 20px;padding-right: 20px;" ><i class="ace-icon fa fa-times "></i>Hayır</span></td>';


    }


    ?> 
             
                                                                                                                                         
                                                                                                                               
                                                                                                                               
                                                                                                                               
                                                                                                                               
                                                                                                                               
                                                                                                                               
                                                                                                                               
                 <!-- şubat ayı -->                                                                                                                   
                                                                                                                               
                                                                                                                               
                                                                                                                               
                                                                                                                           
                                                                                                                                           
                                                                                                                                           
                                                                                                                                           
                                                                                                                                           
                                             
                                                 
           

                                                        </tr>
                                           

       <?php    }?>
                                             
         
                                                   

                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
     

    Ekli Dosyalar:

    Son düzenleme: 23 Ağustos 2017
  2. yunus

    yunus Daimi Üye

    Kayıt:
    26 Şubat 2015
    Mesajlar:
    521
    Beğenilen Mesajlar:
    126
    Bu veya daha karmaşık sorgularda Join kullanabilirsiniz.

    veya bu örnek için basitçe subquery kullanabilirsiniz.

    Kod:
    SELECT B.kullanici_id, B.beyan_adi, B.beyan_turu, B.beyan_ayi, (SELECT K.kullanici_adi FROM kullanicilar  K WHERE  K.kulanici_id = B.kullanici_id) FROM beyan B 
     
  3. koboy

    koboy Üye

    Kayıt:
    5 Ocak 2012
    Mesajlar:
    191
    Beğenilen Mesajlar:
    1
    sor

    sorguyu bağladım ançak başka sorunum var
     
  4. vicivic

    vicivic Yeni Üye

    Kayıt:
    12 Ağustos 2017
    Mesajlar:
    6
    Beğenilen Mesajlar:
    0
    Şehir:
    İzmir
  5. koboy

    koboy Üye

    Kayıt:
    5 Ocak 2012
    Mesajlar:
    191
    Beğenilen Mesajlar:
    1
    Yanıtınız için teşekkür ederim buraya kadar yapabiliyorum ançak benim sorunum başka
    ben tek kullanıcı adı ocak ve ocak şubat mart ve diğer ayların kaydını yanına getirmek istiyorum
    örnek vereyim

    kullanıcı adı:Ali
    beyan_turu:kdv
    beyan_ayi=1

    kullanıcı adı:Ali
    beyan_turu:muhtasar
    beyan_ayi=1

    benim istediğim
    kullanıcı adı kdv_ocak muhtasar_ocak
    ali 1 1


    yan yana gelmesi




    <table>
    <tbody>
    <tr>
    <th>kullanici</th>
    <th>beyan_turu</th>
    <th>beyan_ayi(kdv ocak)</th>
    <th>beyan_ayi(muhtasar ocak)</th>
    </tr>
    <tr>

    <td>Ali</td>
    <td>Ödeme</td>
    <td>1 ödendi (kdv)</td>
    <td>1 ödendi(muhtasar)</td
    </tr>

    </tbody>
    </table>
    </body>
    </html>