It looks like the issue is with your non-standard database structure, perhaps. 

On your Model/Period.php model, set the primary key to be 'period_id' since 
that looks like your primary key:


class Period extends AppModel {

    public $primaryKey = 'period_id';

    /// Other code here...
}


Do this for any models that have a primary key thats not 'id'.

Cheers,
Graham Weldon
http://grahamweldon.com
e. [email protected]
p. (+61) 0407 017 293
Skype: grahamweldon


On Wednesday, 30 November 2011 at 10:50 AM, GG wrote:

> I know why it's not working, I just cannot figure out how to fix it.
> 
> These are my errors:
> 1. Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id'
> in 'where clause'
> 2. SQL Query: SELECT `Period`.`period_id`, `Period`.`title`,
> `Period`.`created`, `Period`.`modified`, `Period`.`user_id` FROM
> `periods` AS `Period` WHERE `id` = '51' AND `user_id` = 1 LIMIT 1
> 
> The query should be: .... WHERE 'period_id' = '51' AND 'user_id' = 1
> LIMIT 1
> 
> I am doing the request from /periods/delete/51
> 
> Here is my PeriodsController.php
> 
> function delete($id) {
> if (!$this->request->is('post')) {
> throw new MethodNotAllowedException();
> }
> 
> if($this->isActionable($id)){
> if ($this->Period->delete($id)) {
> $this->Session->setFlash('Work successfully deleted.');
> $this->redirect(array('controller' => 'posts', 'action' =>
> 'index'));
> }
> } else {
> $this->Session->setFlash('You cannot delete that post.');
> $this->redirect(array('controller' => 'posts', 'action' =>
> 'index'));
> }
> }
> 
> 
> 
> 
> 
> This is in my view Students/index.ctp:
> 
> $this->Form->postLink(
> 'Delete Class',
> array('controller' => 'students', 'action' =>
> 'delete', $ps['Period']['period_id']),
> array('confirm' => 'Are you sure?'));
> 
> 
> 
> -----------
> 
> I'm sure it's something obvious, but I am having a real difficult time
> figuring it out. Thanks!
> 
> -- 
> 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
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php
> 
> 


-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to