Re: Creating new rows

2010-02-14 Thread WebbedIT
> No.

You need to give us something more to work with as something is
obviously wrong in your controller for save to be called twice.

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


Re: Creating new rows

2010-02-13 Thread Akeda Bagus
On Fri, Feb 12, 2010 at 6:07 PM, Jeremy Burns  wrote:
> I have this function in the items model:
>
> function addNewItem() {
>
>        $this->save();
>
>        $itemId = $this->id;
>
>        return $itemId;
>
> }
>

How your controller called it?


-- 
regards,
gedex

blog: http://gedex.web.id

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


Re: Creating new rows

2010-02-13 Thread Jeremy Burns
No.

Jeremy Burns
jeremybu...@me.com
On 13 Feb 2010, at 08:20, WebbedIT wrote:

> The main question is, is it supposed to be creating two rows?
> 
> 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

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


Re: Creating new rows

2010-02-13 Thread WebbedIT
The main question is, is it supposed to be creating two rows?

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


Re: Creating new rows

2010-02-12 Thread anl hp
try with this:

$itemId = $this->getLastInsertID();


--
anl


On Fri, Feb 12, 2010 at 12:07 PM, Jeremy Burns  wrote:

> I have this function in the items model:
>
> function addNewItem() {
>
>$this->save();
>
>$itemId = $this->id;
>
>return $itemId;
>
> }
>
> When called from a controller it does what it is supposed to do;
> creates a new row in the table and returns the id of the new row.
>
> Here's the odd part; it is creating two rows in the database and
> returning the id of the first row. So if the returned id is 100, I'll
> also find id 101 in the table. Any ideas what might be going wrong?
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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


Creating new rows

2010-02-12 Thread Jeremy Burns
I have this function in the items model:

function addNewItem() {

$this->save();

$itemId = $this->id;

return $itemId;

}

When called from a controller it does what it is supposed to do;
creates a new row in the table and returns the id of the new row.

Here's the odd part; it is creating two rows in the database and
returning the id of the first row. So if the returned id is 100, I'll
also find id 101 in the table. Any ideas what might be going wrong?

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