• 06-02-2021, 19:24:29
    #1
    Merhaba, Aşağıdaki gibi kodlar var, bu kodlar ile veri tabanına ilk eklenen veriyi listemde ilk veri olarak yazdırmak istiyorum, Yardımcı olabilir misiniz?
    $this->load->view('category', array(
                'category' => $category,
                'results' => $this->Panel_Model->getAccounts($id , $config['per_page'], !empty($this->input->get('per_page')) && $this->input->get('per_page') <= ceil($config['total_rows']) ? $this->input->get('per_page') :  0   ),
                'links' => $this->pagination->create_links(),
                'csrf' => array(
                    'name' => $this->security->get_csrf_token_name(),
                    'hash' => $this->security->get_csrf_hash()
                )  
            ));
     <tbody>
                    <?php if($results != null): ?>
                        <?php $sayi=1; foreach($results as $result ): ?>
                        
                        <tr>
                        <td><?php echo $sayi++; ?></td>
                          <td><?php echo $result["email"]; ?></td>
                        <td><?php echo date("d/m/Y", $result["created_date"]); ?></td>
                        
                    
                        <td>  <button onclick="showDetails('<?php echo rawurlencode($result["details"]); ?>')" class="btn btn-info btn-sm" data-toggle="tooltip" data-placement="top" title="İndir"><i class="fas fa-eye"> İndir</i></button> </td>
                        </tr>
                        <?php endforeach; ?>
                    <?php else: ?>
                        <tr>
                        <td colspan="6">Herhangi bir konu eklenmemiş</td>
                        </tr>
                    <?php endif; ?>
       </tbody>
  • 06-02-2021, 22:20:32
    #2
    Order By ID <- kullanarak yapabilirsiniz.
  • 06-02-2021, 22:25:59
    #3
    SORGUNUZA;
    "ORDER BY id ASC" yazarsanız ilk eklenen id numarasından itibaren sıralama yapar.
    "ORDER BY id DESC" yazarsanız son eklenen id numarasından itibaren sıralama yapar.