Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 732065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:05:57+00:00 2026-05-14T07:05:57+00:00

I have a function in my Comic Model as such: <?php class Comic extends

  • 0

I have a function in my Comic Model as such:

<?php

class Comic extends AppModel
{
    var $name = "Comic";
    // Methods for retriving information.
    function testFunc(){
        $mr = $this->find('all');
        return $mr;
    }
}
?>

And I am calling it in my controller as such:

<?php
class ComicController extends AppController
{
   var $name = "Comic";
   var $uses = array('Comic');
   function index()
   {
  }
  function view($q)
  {
    $this->set('array',$this->Comic->testFunc());
  }
}
?>

When I try to load up the page; I get the following 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 ‘testFunc’ at line 1 [CORE/cake/libs/model/datasources/dbo_source.php, line 525]
Query: testFunc

And the SQL dump looks like this:

(default) 2 queries took 1 ms
Nr Query Error Affected Num. rows Took (ms)
1 DESCRIBE comics 10 10 1
2 testFunc 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 ‘testFunc’ at line 1 0

So it looks like, instead of running the testFunc() function, it is trying to run a query of “testFunc” and failing…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:05:57+00:00Added an answer on May 14, 2026 at 7:05 am

    OK, I was finally able to reproduce the same error. I suspected the error was Cake trying to “automagically” create model functionality, which it does when it can’t find a model matching the controller. So, what I did was create the controller (app/controllers/comic_controller.php) but not a model. I used the original poster’s exact controller code, and when I tried to invoke the Comic::view action, I got the same error.

    I can only conclude that, similar to the other departures from Cake’s naming conventions, the original poster named the model file in a funny way (e.g. app/models/comics.php) such that Cake was unable to find it, and attempted to compensate with magic. And failed.

    So, to underscore my first comment to the original question, I strongly recommend following the conventions! At the very least, start by following them, then break them one at a time, so that when something breaks, you know why.

    For a “Comics” module, here are the basic components in the conventional naming scheme:

    • Controller:
      • class name: ComicsController extends AppController
      • filename: app/controller/comics_controller.php
    • Model:
      • class name: Comic extends AppModel
      • filename: app/controller/comic.php
    • Views directory: app/views/comics/
    • Database table: comics
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have function like this: function gi_insert() { if(!IS_AJAX){ $this->load->library('form_validation'); $this->form_validation->set_rules('name', 'Naslov', 'trim|required|strip_tags'); $this->form_validation->set_rules('body',
I have function which takes in an parameter of a class called Triple, and
I have this code in my controller (admin): function save(){ $model = $this->getModel('mymodel'); if
i have function like this. function load($name, $arg1, $arg2, $arg3, $arg4){ $this->$name = new
i have function <script type=text/javascript> $(function () { $(#search).click(function() { var text = $(#searchText).val();
I have function called resultAction where I store all the information in $data to
I have: function send(){ $.get(/site/send.php, function(data){ alert(data); } } In site/send.php I have: sleep(1000)
I have function that receives department name and an aggregation operation (average, maximum, minimum)
I have function which append div (help icon) after all element with .help class.
I have function like this in my header function bingframe() { var iframe =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.