I create a library and function show, outputs (results) the Library sent for control,
but there’s in view page following error. What is in your opinion problem?
i put outputs to Controller as return $info; return $results; return $offset; and they of Controller echo in view as: $data['num_count'] = $info; $data['results'] = $results; $data['offset'] = $offset;
error:
A PHP Error was encountered
Severity: Notice
Message:
Undefined variable: info
Filename: admin/accommodation.php
Line Number: 29A PHP Error was encountered
Severity: Notice
Message:
Undefined variable: results
Filename: admin/accommodation.php
Line Number: 30Fatal error: Call to a member function result() on a non-object in
D:\xampp\htdocs\Siran-mehdi\system\core\Loader.php(679) : eval()’d
code on line 46
When you call return, it quits the function at that point, and it doesn’t return literally $info so you can keep using that name, but the data inside of that variable.
At the end of your library, change the three returns to something like:
This will return an associative array.
and in your controller:
Where $data will become that array returned by the library.