Thanks Alan, my table is definitely being populated now. I've fixed up
the controller names to follow the convention.

On my PracticeItems/index view I have created a link to the add form
like so:
echo $html->link('add new item', array('controller' =>
'PracticeItems', 'action' => 'add'));

When I arrive at the page, the url is /cakeRoot/PracticeItems/add

When the form submits, the url changes to /cakeRoot/practice_items/add

Why won't $html->link put the url in the conventional format?
(practice_items)

Would it make more sense to say
echo $html->link('add new item', array('controller' =>
'practice_items', 'action' => 'add'));

in order to keep with convention?

Furthermore, when I enable the redirect in
practice_items_controller.php, I get an error when the redirect
executes. The redirect line is as follows:
$this->redirect(array('action' => 'index'));

which should take me to /cakeRoot/PracticeItems/index, but instead I
get the error:

Warning (2): Cannot modify header information - headers already sent
by (output started at /var/www/go/htdocs/practicelog/cake/basics.php:
306) [CORE/cake/libs/controller/controller.php, line 644]

EDIT: I fixed this issue by disabling the line that said
$this->set('debug', pr($this->data));

It would seem sending data to the view makes a redirect impossible.
I've included this in case anyone has a similar issue in the future.

On 14 Apr, 17:17, "Alan Asher" <a...@asteriskpound.com> wrote:
> In your practice_items_controller.php your pr should not have the lowercase
> and underscored array element.
>
> Check your form or wherever you're assigning this array and your pr should
> look like
>
> Array
> (
>     [PracticeItem] => Array
>         (
>             [name] => Test
>             [description] => Test
>         )
> )
>
> PracticeItem is the Model Name
>
> This is part of the whole convention over configuration.
>
> Alan
>
> -----Original Message-----
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
>
> Of Johnny Ferguson
> Sent: Wednesday, April 14, 2010 2:10 PM
> To: CakePHP
> Subject: Re: Cake won't save my data
>
> I've checked with the folks in the IRC, and it looks like Cake
> shouldn't care if I'm using InnoDB, but my data still won't show up in
> the tables regardless of Cake giving me every indication that the save
> was successful.
>
> On 14 Apr, 16:43, Johnny Ferguson <hyperfle...@gmail.com> wrote:
> > I'm using InnoDB to allow data associations. Do I have to note this
> > fact in my database.php?
>
> > Other than that, I'm at a loss as to why this problem is occurring.
>
> > My practice_items table:
> > int - id
> > varchar(255) - name
> > text - description
>
> /app/controllers/practice_items_controller.php:http://pastebin.com/K3uu38fw
>
> > /app/views/practice_items/add.ctp:http://pastebin.com/dfxrnhhT
>
> > the pr() statement successfully puts out the data I post through the
> > form when using the add() method. I get this as a result of pr():
>
> > Array
> > (
> >     [practice_items] => Array
> >         (
> >             [name] => Test
> >             [description] => Test
> >         )
>
> > )
>
> > As I understand it, since id is auto-increment, I shouldn't need to
> > explicitly pass that through the form. Cake gives me every indication
> > that the save method worked, so I'm at a loss as to why the data isn't
> > showing up in my practice_items table. I would think at the very least
> > that cake would spit back a MySQL error if something were wrong.
>
> > Here's my controller dump:http://pastebin.com/KHiZt8J8
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en
>
> To unsubscribe, reply using "remove me" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to