can'nt see the view in codeigniter

4 views
Skip to first unread message

Chaitrali

unread,
Dec 29, 2009, 2:04:43 AM12/29/09
to phpcamp
Hi,
I am trying for long time to view the output of resultset in model.
but $this->load->view('you_view',$data) is not reflecting in view.it's
saying undefined
variable and Invalid argument supplied for foreach().

Please tell me solution.

Ashish Lakhotia

unread,
Dec 29, 2009, 2:08:11 AM12/29/09
to php...@googlegroups.com
Can u please send the exact error as it is seen on the screen...
it will help a bit in identifying the situation

--
Follow Us On Twitter ==>  http://twitter.com/phpcamp

You received this message because you are subscribed to the Google
Groups "phpcamp" group.
To post to this group, send email to php...@googlegroups.com
To unsubscribe from this group, send email to
phpcamp+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phpcamp?hl=en-GB

Ashish Lakhotia

unread,
Dec 29, 2009, 2:08:55 AM12/29/09
to php...@googlegroups.com, chait...@gmail.com
Can u please send the exact error as it is seen on the screen...
it will help a bit in identifying the situation

On Tue, Dec 29, 2009 at 12:34 PM, Chaitrali <chait...@gmail.com> wrote:

Chaitrali

unread,
Dec 29, 2009, 3:44:03 AM12/29/09
to phpcamp
hI,
in view i hv this:
foreach($stud as $user):

echo $user['studid'].':'.$user['school_name'] .'<br />';

endforeach;?>
in controller i hv this:
function index()
{
$this->data['stud'] = $this->model_index->model_db();
$this->load->view('you_view',$this->data);
}

Errors:
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: stud

Filename: views/you_view.php


A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: views/you_view.php


A PHP Error was encountered

Severity: Notice

Message: Undefined variable: user

Filename: views/you_view.php

On Dec 29, 12:08 pm, Ashish Lakhotia <ashish.geni...@gmail.com> wrote:
> Can u please send the exact error as it is seen on the screen...
> it will help a bit in identifying the situation
>

> On Tue, Dec 29, 2009 at 12:34 PM, Chaitrali <chaitra...@gmail.com> wrote:
> > Hi,
> >  I am trying for long time to view the output of resultset in model.
> > but $this->load->view('you_view',$data) is not reflecting in view.it's
> > saying undefined
> > variable and Invalid argument supplied for foreach().
>
> > Please tell me solution.
>
> > --
> > Follow Us On Twitter ==>  http://twitter.com/phpcamp
>
> > You received this message because you are subscribed to the Google
> > Groups "phpcamp" group.
> > To post to this group, send email to php...@googlegroups.com
> > To unsubscribe from this group, send email to

> > phpcamp+u...@googlegroups.com<phpcamp%2Bunsu...@googlegroups.com>

Ashish Lakhotia

unread,
Dec 29, 2009, 11:30:22 PM12/29/09
to php...@googlegroups.com
code looks good
please take the output resultset of model into a variable and var_dump it and check if u r really getting an array from there...

Chaitrali Deshpande

unread,
Dec 30, 2009, 12:21:36 AM12/30/09
to php...@googlegroups.com
it worked. thank you!
Reply all
Reply to author
Forward
0 new messages