codeigniter

W.Joe

Well-known member
  • Apr 6, 2013
    1,492
    241
    63
    meka product catelog 1k .... eth view wenne na product details....

    controller
    public function Show_all_products()
    {
    $this->load->model('billing_model');
    $data ['query'] = $this->billing_model->viewauction();
    $this->load->view('item/b', $data);
    }

    model
    { return $this->db->get('items')->result();
    $query = $this->db->get('items');
    return $query->result() ;
    }


    view
    <tbody>
    <?php foreach($query as $row): ?>
    <tr>

    <td><?php echo $row->item_id; ?></td>
    <td><?php echo $row->item_name; ?></td>
    <td><?php echo $row->item_size; ?></td>
    <td><?php echo $row->item_price; ?></td>


    </tr>
    <?php endforeach; ?>

    </tbody>
     

    Unclesam

    Well-known member
  • Oct 18, 2013
    637
    251
    63
    meka product catelog 1k .... eth view wenne na product details....

    controller
    public function Show_all_products()
    {
    $this->load->model('billing_model');
    $data ['query'] = $this->billing_model->viewauction();
    $this->load->view('item/b', $data);
    }

    model
    { return $this->db->get('items')->result();
    $query = $this->db->get('items');
    return $query->result() ;
    }


    view
    <tbody>
    <?php foreach($query as $row): ?>
    <tr>

    <td><?php echo $row->item_id; ?></td>
    <td><?php echo $row->item_name; ?></td>
    <td><?php echo $row->item_size; ?></td>
    <td><?php echo $row->item_price; ?></td>


    </tr>
    <?php endforeach; ?>

    </tbody>

    Model eka hariyata danna balanna
     

    W.Joe

    Well-known member
  • Apr 6, 2013
    1,492
    241
    63
    <?php Class billing_model extends CI_Model {


    function Show_all_products()

    { return $this->db->get('items')->result();
    $query = $this->db->get('items');
    return $query->result() ;
    }
    }


    machan man use karanne CI 3.1 version eka ..... godak ayata awith tiyenawa me awula ...search kaama dakke ...eth solution 1k nane....
     
    Last edited:

    Barry Allen

    Member
    Oct 15, 2016
    2,855
    139
    0
    Central City
    PHP:
    function Show_all_products(){
    
     $this->db->select ( '*' );
     $this->db->from ( 'items' );
     $query = $this->db->get ();
     return $query->result ();
    }

    දෙපාරක් return කරලා නේද මේකේ :eek: අනිත් වැරැද්ද දෙකෙන්ම වෙන්නේ එකම දේනේ :oo:

    PHP:
    function Show_all_products()
    
    { 
     return $this->db->get('items')->result();
    
     $query = $this->db->get('items'); 
     return $query->result();
    
    }

    PHP:
    <?php Class billing_model extends CI_Model
    {
    කැපිටල් වෙන්න ඕන model එකේ මුල් character එක..(3.0.0 වල සිට ආපු රුල් එකක් )

    හරි විදිය
    PHP:
    <?php Class Billing_model extends CI_Model {
     
    Last edited: