cakephp-1.3

using AND condition MYsql [duplicate]

倾然丶 夕夏残阳落幕 提交于 2019-12-25 06:38:03
问题 This question already has answers here : Find Condition by And doen't work + cakephp (2 answers) Closed 6 years ago . What I need is: when I give training_id 172 AND training_id 174 it have to return user 150 only I tried this but it doen't work SELECT user_id FROM Training_users WHERE training_id = 172 AND training_id = 174 Most of the times training_id might be more than 2 回答1: What about this query: SELECT user_id, COUNT(*) as nbTrainings FROM Training_users WHERE training_id = 172 OR

CakePHP error: Call to a member function getColumnType()

五迷三道 提交于 2019-12-25 05:35:10
问题 I'm trying to edit a record in the database, but the script gives me the following error: Fatal error: Call to a member function getColumnType() on a non-object in G:\wamp\www\a11\a\cake\libs\model\model.php on line 980 The strange thing is, if I remove id from the form (so it creates a new record) it doesn't complain. That means that there's something wrong with the id column. But what? Just before the save I dump the array that is going to be saved: Array ( [Process] => Array ( [id] => 5

Accessing invalidFields from the view

▼魔方 西西 提交于 2019-12-25 02:18:54
问题 I have a form that collects information from several models that are several layers apart in their association. For that reason, I have to save each individually and, if any fail, report back to the view so that error messages can be displayed. Because of the sequential saves, I assume, any errors aren't appearing correctly, nor am I finding that the isFieldError() method is catching the existence of the error. Any idea how I can access this data at the view level to check for an error? I'd

How to limit the fields of the associated models using find method

一曲冷凌霜 提交于 2019-12-25 01:32:31
问题 I have user model and articles model. An User hasMany articles. So when I query for a user, all fields for article table is retrieved. I want to limit it just title of articles. $user = $this->User->find('all', array('conditions' => array('User.id' => $id), 'fields' => array('User.firstName', 'Article.title'))); The fields works fine for user model. But it does not work for associated models. throws error SQL Error: 1054: Unknown column 'Article.title' in 'field list' I appreciate any help.

cakephp choosing language by url

吃可爱长大的小学妹 提交于 2019-12-24 17:18:21
问题 what I am trying to achieve is described here http://nuts-and-bolts-of-cakephp.com/2008/11/28/cakephp-url-based-language-switching-for-i18n-and-l10n-internationalization-and-localization/ but I can not get it working. The router configurations looks like this: Router::connect('/registered/:language/:controller/:action/*', array('prefix' => 'registered', 'registered' => true, 'layout'=> 'registered'), array('language' => '[a-z]{3}')); butw when I try to go to www.example.com/registered/cze

Site Configuration for Nginx Sub-Folder

佐手、 提交于 2019-12-24 08:59:04
问题 I have a project that I want in a sub-folder off a main domain (sitename.org/projectname). It is a cakephp 1.3 project with nginx 1.2.0. I have been googling / trying solutions online for the better part of 2 days. I will be eventually adding more projects as sub-folders and each one will have its own root. First, a working configuration if the site is placed in the root domain. server { listen 80; server_name sitename.org location / { root /export/home/sitename.org/projectname/app/webroot;

How to connect Cakephp 1.3 with MS SQLServer 2008?

我们两清 提交于 2019-12-24 08:08:43
问题 I can't connect to MSSQL Server. I've been researching for 2 days, yet I can't find any useful resources. This is the error I'm getting: URL rewriting is not properly configured on your server. Help me configure my database. I don't / can't use URL rewriting: Your tmp directory is writable. The FileEngine is being used for caching. To change the config edit APP/config/core.php Your database configuration file is present. Here's my database config file: class DATABASE_CONFIG { var $default =

Structuring a CakePHP Registration Page

瘦欲@ 提交于 2019-12-24 07:19:35
问题 I have a site where I want users to register to particular groups. In order to access that group, you need to know their Organization ID and Organization Password. I am trying to create a form which will allow me to validate that the Group ID and Password exist and are correct, then create a new User. I want to Validate all of the fields in the User form and have them auto-magically print errors if they do not work. Ironically, when I "baked" my application it creates forms which successfully

How to give select tag an attribute in cake php?

こ雲淡風輕ζ 提交于 2019-12-24 07:10:46
问题 How to give select tag an attribute in cake php ? $options = array('0' => 'News', '1' => 'Movies'); echo $this->Form->select('selectValue', $options, 0, array('id' => 'select') ) So that I can give a attribute data-url to every options <select id="select" name="data[Video][gender]" > <option value="0" data-url = "/news" >News</option> <option value="1" data-url = "/movies" >Movies</option> </select> 回答1: you can't :P or at least there's no easy way to do it... You'll need to extend the

Cakephp Import Controller

老子叫甜甜 提交于 2019-12-24 03:22:39
问题 I am new in cakephp and I want to import controller in my controller so i use the below syntax. This is my controller in which I import user controller: users_controller.php function api_work(){ $data = $this->User->find('all'); $this->set('data' , $data); } plays_controller.php function api_show() { $this->layout= false; App::import('Controller', 'Users'); $Users = new UsersController; $Users->constructClasses(); $data = $Users->api_work(); pr($data); //it not display anything and shows