Monday, February 28, 2011

Re: Can't Save to DB

So i've changed the save() to updateAll() with the following:
if($this->Episode->updateAll( array('Episode.name' => $episode['name']), array('Episode.number' => $episode['number']), array('Episode.description' => $episode['description']), array('Episode.date' => $episode['date']), array('Episode.show_id' => $episode['show_id']))){

Now I get an "SQL Error: 1054: Unknown column 'Stowaway' in 'field list'". The query that it shows is:
Query: UPDATE `episodes` AS `Episode` LEFT JOIN `shows` AS `Show` ON (`Episode`.`show_id` = `Show`.`id`) SET `Episode`.`name` = Stowaway  WHERE `Episode`.`number` = 17

Is it because it's looking for an already existing entry? (not sure entry is the right word). Shouldn't the SQL query be ADD instead of UPDATE?

I've tried using saveAll() too, but that has the same effect as save(). :-S

Really stuck here. I'm including a screenshot of the episodes table (viewed from phpMyAdmin). Could there be a conflict between the names in the array and the names in the table?

--
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: