• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with invalid constant in VIEW

[eluser]Ivan Augusto[/eluser]
Hello, i need assistance =]~

I created this Controller:

class Projects extends Controller {

    function Projects()
    function index()
        $data['title'] = "Projects";
        $data['projects'] = $this->db->get('projects');
And this view:

<table border="1">
    &lt;? foreach ($projects as $project) : ?&gt;
    &lt;? endforeach; ?&gt;
but I get this message:

Quote:A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant titulo - assumed 'title'
Filename: views/projetos.php


Thks 4all ;]~

You're missing the dollar sign when printing the table name
change it to

[eluser]Yorick Peterse[/eluser]
EDIT: Nevermind...

[eluser]Ivan Augusto[/eluser]
I fixed and I still get the same thing ;/~

Oh, missed that one, you need a dollar sign in front of title

[eluser]Ivan Augusto[/eluser]
Uepa! i missing $ in the title, but now is giving problem in foreach, the following error:

Quote:A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: views/projects.php
Line Number: 14



the title needs it's $, too

Whats your current code, cause line 14 is the closing body tag?
When posting your current code, mark the 14th line

[eluser]Ivan Augusto[/eluser]
i wasn't watching the right method to call in foreach for printing variable and now everything works fine xD~

CI r0x =]~

Thks man =D~

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.