Welcome Guest, Not a member yet? Register   Sign In
Trying to use MVC
#1

[eluser]d4v0[/eluser]
Hi everybody!
I've been trying to work with with the MVC using CI, but i have some problems! :red:
I'm just a beginner! ... But I want to learn more than CI! Tongue

Well, this is my model: 'mimodelo.php'

Code:
<?PHP
class Mimodelo extends Model
{
    function Mimodelo()
    {
        parent::Model();
    }
    function obtenertodo()
    {
        $datos = array();
        $consulta = $this->db->get("ALL_M_RUB");
        $datos = $consulta->row_array();
        return $datos;
    }
}
?>

As you see, my table's name is ALL_M_RUB.

This is my controller: 'micontrol.php' :cheese:

Code:
<?PHP
class Micontrol extends Controller
{
    function Micontrol()
    {
        parent::Controller();
        $this->load->database();
    }
    
    function index()
    {
        $this->load->model('Mimodelo','',TRUE);
        $data['contenido'] = $this->Mimodelo->obtenertodo();
        $this->load->view('mivista',$data);
    }
}
?>

And finally, this is my view ... but it's incomplete... 'mivista.php' :roll:

Code:
<?PHP
foreach($contenido as $elemento)
{
    //here goes my results
}
?>

That's my poblem..! :-S ... I don't know how to catch the results and show them all!

The fields of my table are 3: 'RUB_ORD' , 'RUB_DES' and 'RUB_STATUS'.

What is missing... or what am i doing bad??

Help! ... =(

Thanks!


Messages In This Thread
Trying to use MVC - by El Forum - 11-07-2008, 09:47 PM
Trying to use MVC - by El Forum - 11-07-2008, 10:48 PM
Trying to use MVC - by El Forum - 11-07-2008, 11:28 PM
Trying to use MVC - by El Forum - 11-08-2008, 02:07 AM
Trying to use MVC - by El Forum - 11-08-2008, 06:49 PM
Trying to use MVC - by El Forum - 11-08-2008, 08:37 PM
Trying to use MVC - by El Forum - 12-10-2008, 08:19 AM
Trying to use MVC - by El Forum - 12-11-2008, 04:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB