Page 1 of 1
Invalid arguement supplied for a view?
Posted: Wed Oct 24, 2007 5:49 pm
by Opie
I'm working on this new component to list currently active projects for my company. The front end works on 1.5RC3 on a XAMPP server running on a WinXP machine.
However, when I bring it to work and install it, which it does without errors, it provides the following warnings / errors. The office environment is a Win2k machine with IIS.
Warning: Invalid argument supplied for foreach() in ...\views\projects\tmpl\default.php on line 10
Line 10 of that file is
Code: Select all
<?php foreach ( $this->projects as $project ) : ?>
I'm assuming it is
$this->projects that is the problem.
Any ideas for what I need to look into?
Re: Invalid arguement supplied for a view?
Posted: Wed Oct 24, 2007 7:47 pm
by ianmac
Trace back to where $this->projects comes from and echo at various points along the way to figure out what is going wrong...
Presumably, $projects is not an array as it is supposed to be for foreach.
If that is in your layout, then go back into your view and make sure it gets assigned. Then, check your model to see if something is going wrong there, and work back until you figure out what is failing.
Ian
Re: Invalid arguement supplied for a view?
Posted: Thu Oct 25, 2007 1:11 pm
by Opie
Thanks. I'll post back if I can't find it from there.
Re: Invalid arguement supplied for a view?
Posted: Thu Oct 25, 2007 8:15 pm
by Opie
ianmac wrote:Trace back to where $this->projects comes from and echo at various points along the way to figure out what is going wrong...
Presumably, $projects is not an array as it is supposed to be for foreach.
If that is in your layout, then go back into your view and make sure it gets assigned. Then, check your model to see if something is going wrong there, and work back until you figure out what is failing.
Ian
It seems this call is failing in my model. The model is being called.
Code: Select all
$this->_data = $this->_getList($query);
Any ideas? I have tried to model this on the weblinks core component.
Re: Invalid arguement supplied for a view?
Posted: Thu Oct 25, 2007 8:19 pm
by ianmac
Have you tested to ensure that the query does work?
Ian
Re: Invalid arguement supplied for a view?
Posted: Thu Oct 25, 2007 8:27 pm
by Opie
ianmac wrote:Have you tested to ensure that the query does work?
Ian
The little things will get you. Apparently, I need to work on my install.sql file for the installation. The table was not created in the database.
At the end of my create table I have the following.
Code: Select all
ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
When I try to create the table with phpMyAdmin, an error occurs regarding the
CHARSET=utf8; portion. Should I not have that in there?
Re: Invalid arguement supplied for a view?
Posted: Thu Oct 25, 2007 8:31 pm
by ianmac
I dunno... this is what I use:*
TYPE=MyISAM DEFAULT CHARSET=utf8 COLLATE `utf8_general_ci` AUTO_INCREMENT=1;
Ian
*I am not a database expert. I know basics of SQL, and that is about it. I don't even know joins that well, so, take that for what it is worth.
Re: Invalid arguement supplied for a view?
Posted: Thu Oct 25, 2007 8:38 pm
by Opie
ianmac wrote:I dunno... this is what I use:*
TYPE=MyISAM DEFAULT CHARSET=utf8 COLLATE `utf8_general_ci` AUTO_INCREMENT=1;
Ian
*I am not a database expert. I know basics of SQL, and that is about it. I don't even know joins that well, so, take that for what it is worth.
You're ahead of me.

It still did not work. However, I don't see a need for this component in the general public as this is for internal use for my company's project list. I'll have to look into this SQL issue at a later date.
Thanks for the help.
Re: Invalid arguement supplied for a view?
Posted: Thu Oct 25, 2007 8:40 pm
by ianmac
What version of MySQL are you using?
Ian
Re: Invalid arguement supplied for a view?
Posted: Thu Oct 25, 2007 9:03 pm
by Opie
It's been so long since I installed, I can't remember.
It appears to be Server version 4.0.18 and Client version of 5.0.0. Looks like I may need to update it.