Wednesday, March 2, 2011

Model function error

Hello Everybody,

I am having a problem with CakePHP models. I have several in use but
only one gives me an error when i add a function and call it from a
controller. I have a model called Invoice with a saveValue function
which works like a charm. I also have model with the same function but
this one gives me the following error message. It seems the function
is not called and the function name is being passed as SQL code.

<pre class="cake-debug"><a href="javascript:void(0);"
onclick="document.getElementById('cakeErr1-trace').style.display =
(document.getElementById('cakeErr1-trace').style.display == 'none' ?
'' : 'none');"><b>Warning</b> (512)</a>: <span style="color: Red; text-
align: left;"><b>SQL Error:</b> 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 'saveValue' at line 1</span> [<b>CORE
\cake\libs\model\datasources\dbo_source.php</b>, line <b>684</b>]<div
id="cakeErr1-trace" class="cake-stack-trace" style=""><a
href="javascript:void(0);" onclick="document.getElementById('cakeErr1-
code').style.display = (document.getElementById('cakeErr1-
code').style.display == 'none' ? '' : 'none')">Code</a> | <a
href="javascript:void(0);" onclick="document.getElementById('cakeErr1-
context').style.display = (document.getElementById('cakeErr1-
context').style.display == 'none' ? '' : 'none')">Context</a><div
id="cakeErr1-code" class="cake-code-dump" style="display:
none;"><pre><code><span style="color: rgb(0, 0,
0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$out&nbsp;=&nbsp;null;</span></code>
<code><span style="color: rgb(0, 0,
0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;
($error)&nbsp;{</span></code>
<span class="code-highlight"><code><span style="color: rgb(0, 0,
0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trigger_error('&lt;span&nbsp;style="color:Red;text-
align:left"&gt;&lt;b&gt;'&nbsp;.&nbsp;__('SQL&nbsp;Error:',&nbsp;true)&nbsp;.&nbsp;"&lt;/
b&gt;&nbsp;{$this-&gt;error}&lt;/span&gt;",&nbsp;E_USER_WARNING);</
span></code></span></pre></div><pre id="cakeErr1-context" class="cake-
context" style="display: none;">$sql = "saveValue"
$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 'saveValue' at line 1"
$out = null</pre><pre class="stack-trace">DboSource::showQuery() - CORE
\cake\libs\model\datasources\dbo_source.php, line 684
DboSource::execute() - CORE\cake\libs\model\datasources
\dbo_source.php, line 266
DboSource::fetchAll() - CORE\cake\libs\model\datasources
\dbo_source.php, line 410
DboSource::query() - CORE\cake\libs\model\datasources\dbo_source.php,
line 364
Model::call__() - CORE\cake\libs\model\model.php, line 502
Overloadable::__call() - CORE\cake\libs\overloadable_php5.php, line 50
AppModel::saveValue() - [internal], line ??
InvoicesController::edit() - APP\controllers\invoices_controller.php,
line 225
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83</pre></div></pre><pre><p
style="text-align: left;"><b>Query:</b> saveValue </p></pre>

Any help would be greatly appreciated.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: