Hi there
You cannot make a query on a controller, only on a model.
Assuming that the model related to this controller is called Post,
you can try using $this->controller->Post->query(...)
I haven't tried this yet, but it might work.
A better idea might be to write a method in the controller that makes
the query
and returns the result. Then use this method in your component.
Claudia
Claudia
On Jan 23, 9:30 am, "Louie Miranda" <[EMAIL PROTECTED]> wrote:
> Am i wrong?
>
> On Jan 23, 2008 1:37 PM, Louie Miranda <[EMAIL PROTECTED]> wrote:
>
>
>
> > I am trying to query some table on a component. But, this error keeps on
> > showing up.
>
> > *Fatal error*: Call to undefined method PostsController::query() in *
> > /site/www/app/controllers/components/web_logs.php* on line *21*
>
> > My code:
>
> > *my controller (note: i already declared "WebLogs" on var $components =
> > array('WebLogs');*
>
> > > *$this->WebLogs->ActivityLog('[EMAIL PROTECTED]'); // get from
> > > session*
>
> > *my component*
>
> > > *class WebLogsComponent extends Object {
>
> > > var $controller = true;
>
> > > function initialize(&$controller) { // used initialize, instead of
> > > startup?
> > > $this->controller =& $controller;
> > > }
>
> > > function ActivityLog($username) {
> > > $this->controller->query("select * from table where username =
> > > '$username'"); // check mysql.log if it is being executed
> > > ......
> > > return true;
> > > }
> > > }*
>
> > Please help!
>
> > --
> > Louie Miranda ([EMAIL PROTECTED])
> >http://www.axishift.com
>
> > Security Is A Series Of Well-Defined Steps
> > chmod -R 0 / ; and smile :)
>
> --
> Louie Miranda ([EMAIL PROTECTED])http://www.axishift.com
>
> Security Is A Series Of Well-Defined Steps
> chmod -R 0 / ; and smile :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---