Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14343

Controller (from model to view)

$
0
0
Hello, i'm new in CI , and i don't understand something.I have  a model like

PHP Code:
class Contact_model extends CI_Model {
 
 public function start()
 
 {
 
    $query $this->db->get('utilizatori'10);
 
    return $query->result();
 
 }



A controller 
PHP Code:
    class Contact extends CI_Controller{
        public function 
index(){
            
$this->load->model('Contact_model');
            
$data $this->Contact_model->start();
//here i added for testing a var_dump($data) and show me results from mysql successfully
            
$this->load->view('contact',$data);
        }
    } 

And i don't know in view (contact.php) how i can foreach($data) from model.How pass something like this in good practice?Thank u.

Viewing all articles
Browse latest Browse all 14343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>