Can i call admin panel controller from account controller?
I mean in account controller i set acessible parts of admin panel and i want to transfer that variable with accessible place to admin panel controller.
and now can i do sth like:
<?php
// Code here
$this->panel = new Admin_Panel();
$this->panel->accessibleparts = $this->data['accessible'];
?>
Or is it disallowed in mvc rules?
The answer is read about how it works in the manual: http://php.net/oop5
You get the following errors:
You then ask:
No worries. You just made a little mistake. The mistake is that you make use of the function
mysql_real_escape_stringwhile not using a connection of themysql_*extensions (note: extension, not database server).In case you’re calling that function without establishing a
mysql_*extension database connection, PHP will automatically create one based on the settings provided in php.ini. That is normally only the host set to localhost – but wihout username and password.This is why you see the first error that the connection fails and the second error is the result of the failed connection – there is no link to the databse, so ?
mysql_real_escape_stringcan not work.To solve the problem, just do not use
mysql_real_escape_stringwhen you’re using mysql viaPDO. Prepared statements is all you need.