I asked this question on the CakePHP google-group but didn't find any resolution, so hopefully will have better luck here.
I've been developing on CakePHP for a bit and decided to have a localhost version on MAMP so that I could demo my app to people without being dependent on an Internet connection.
We have a couple of complex MySQL queries being made, and using
$this->query('SELECT...');
We've placed these in the appropriate models within a function to remove all this logic from the controller. Hence from the Controller we'll have something like
$this->Users->getMeSomething($variable);
, that goes to the user.php model and runs that function. This works fine on our live and dev sites, but for some reason on MAMP I'm getting an error whenever this type of call is made, as an example of one of the calls:
Error:
Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near '__getUsersForUsers' at line 1 [CORE/cake/
libs/model/datasources/dbo_source.php, line 525]
Context:
DboSource::showQuery() - CORE/cake/libs/model/datasources/
dbo_source.php, line 525
DboSource::execute() - CORE/cake/libs/model/datasources/
dbo_source.php, line 201
DboSource::fetchAll() - CORE/cake/libs/model/datasources/
dbo_source.php, line 336
DboSource::query() - CORE/cake/libs/model/datasources/dbo_source.php,
line 297
Model::call__() - CORE/cake/libs/model/model.php, line 441
Overloadable::__call() - CORE/cake/libs/overloadable_php5.php, line 52
AppModel::__getUsersForUsers() - [internal], line ??
UsersController::view() - APP/controllers/users_controller.php, line
401
Object::dispatchMethod() - CORE/cake/libs/object.php, line 118
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 227
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 194
[main] - APP/webroot/index.php, line 88
Line 88 on webroot is this: $Dispatcher->dispatch($url);
I've tried both 1.2 and 1.2.5 of CakePHP. MySQL on MAMP is 5.1.31 and on my host, MediaTemple, is 5.1.26-rc
Thanks for any help