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 8665405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:28:30+00:00 2026-06-12T17:28:30+00:00

I am using the framework cakePHP for my application. I programmed it on localhost

  • 0

I am using the framework cakePHP for my application. I programmed it on localhost with xampp and try to upload it on my website now. It worked without any problems on localhost. Now there is only this one page, which does not work on the new server. The other sites (which use the database connection too) work alright.

For this one site the following message appears:

Error: SQLSTATE[42000]: Syntax error or access violation: 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 ‘add’ at line 1

SQL Query: add

The function add() looks like this.

public function add() { 
      //$this->create();
      $word_id = $this->Word->getWord_id();
      $save = $this->save(array('word_id' => $word_id, 'text' => $this->getText($word_id), 'mistake' => 0));
      return $save['Game']['id']; 
   }

On localhost I used MySQL-Client-Version: mysqlnd 5.0.8-dev – 20102224 – $Revision: 310735 $ and PHP Version 5.3.8.

On the server I use MySQL-Client-Version: 5.1.62 and PHP Version 5.3.17.

Thank you very much for helping!

Edit:
The model ‘Game’:

class Game extends AppModel {
   public $name = 'Game';
   public $belongsTo = 'Word';
   public $searchedWord = '';

   public function addGame() { // Create new game
      $word_id = $this->Word->getWord_id();
      $save = $this->save(array('word_id' => $word_id, 'text' => $this->getText($word_id), 'mistake' => 0));
      return $save['Game']['id']; // Build the hangman
    }
}

When I debug $this->Game, the output is:

object(AppModel) {
        useDbConfig => 'default'
        useTable => 'games'
        id => null
        data => array()
        schemaName => null
        table => 'games'
        primaryKey => 'id'
        validate => array()
        validationErrors => array()
        validationDomain => null
        name => 'Game'
        alias => 'Game'
        tableToModel => array(
            'games' => 'Game'
        )
        cacheQueries => false
        belongsTo => array()
        hasOne => array()
        hasMany => array()
        hasAndBelongsToMany => array()
        actsAs => null
        Behaviors => object(BehaviorCollection) {
            modelName => 'Game'
            defaultPriority => (int) 10
        }
        whitelist => array()
        cacheSources => true
        findQueryType => null
        recursive => (int) 1
        order => null
        virtualFields => array()
        __backAssociation => array()
        __backInnerAssociation => array()
        __backOriginalAssociation => array()
        __backContainableAssociation => array()
        findMethods => array(
            'all' => true,
            'first' => true,
            'count' => true,
            'neighbors' => true,
            'list' => true,
            'threaded' => true
        )
}
  • 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-06-12T17:28:31+00:00Added an answer on June 12, 2026 at 5:28 pm

    usually, if this error happens, you don’t have the model instance, but an app model instance you work on. the app model instance doesnt have the add() method and directly queries the db with add().

    so make sure your model is properly included. since you didnt show us the code how you call the method (and how you make the model available to the controller) I cannot offer any concrete advice, though.

    if you manually include it:

    $this->ModelName = ClassRegistry::init('ModelName');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using cakephp framework to build my application. I want that, whenever a
I'm using the cakephp framework to develop an application and I'm running into some
I am starting to develop a website using CakePHP for my framework, I've literally
I am working on a website build using cakephp framework. My problem is that
I am using cakePHP framework to build a website in which I want to
I'm recoding an existing project by using the CakePHP framework. Now, in my existing
I have build an e-commerce website with CakePHP Framework. Now, i need to implement
I am using the CakePHP framework to implement a Web application. I would add
I'm using the cakePHP framework for my website and I would like to create
I am working on development of an application using CakePHP framework. We all have

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.