Re: Copying a db record

2006-09-20 Thread [EMAIL PROTECTED]
nannyforum, just out of curiousity, do you have a separate table for Sexes? that's what it looks like, and i'm trying to figure out why. Do you anticipate having to add a third sex when AI is invented or something? :-) --~--~-~--~~~---~--~~ You received this

Re: Copying a db record

2006-09-20 Thread [EMAIL PROTECTED]
chris - This is a legacy (MS Access) app that I'm transferring, so I was living with the decisions of the prior developer. If I'm not too lazy, I'll probably change the whole sexes thing. nate - I don't understand why it is not considered a bug. I understand that Cake is intercepting all

Re: Copying a db record

2006-09-20 Thread nate
nate - I don't understand why it is not considered a bug. I understand that Cake is intercepting all requests, but why should a request for favicon.ico be turned into extra requests for the database transaction? Because however you have your controller code setup, the path that is being

Re: Copying a db record

2006-09-19 Thread Cheeze
Very interesting indeed! Is this considered a bug? Maybe it ought to be tracked? If correction of this bug isn't possible, maybe it should be placed in somewhere obvious? Will help save a lot of headaches for those unaware - even the veterans.

Re: Copying a db record

2006-09-19 Thread nate
This isn't a bug in the framework per se. Cake will intercept any HTTP request for a file that doesn't exist in app/webroot, including things like favicons. See here: http://withcake.com/posts/view/watch_your_paths --~--~-~--~~~---~--~~ You received this

Re: Copying a db record

2006-09-17 Thread [EMAIL PROTECTED]
What a saga! And the dramatic ending can't be beat. Thank you all for an interesting story. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to

Re: Copying a db record

2006-09-16 Thread [EMAIL PROTECTED]
Do a LogError('controller action called'); at the top of your controller action and see in app/tmp/logs/error.log, how often the controller action is really called. I had a very similar problem this week and it turned out, that the action was called several times. The source of the problem was,

Re: Copying a db record

2006-09-16 Thread [EMAIL PROTECTED]
Dirk - you were right! First, I replaced the $this-Applicant-save($this-data); line with a direct SQL query, inserting a record. Lo and behold, it inserted 3 records, exactly the same as before. I went to the layout file (I was using the default cakephp layout) and removed the favicon.ico

Re: Copying a db record

2006-09-15 Thread John Zimmerman
On 9/14/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: .clippedWhat I want to do is simple - take the original Applicant record (schoolyear = 16) and copy them to a new record, with all the samedata, except that the schoolyear = 15.$this-Applicant-id = $id;$this-data = ""

Re: Copying a db record

2006-09-15 Thread [EMAIL PROTECTED]
Thanks for the reply. I tried unsetting the 'id' value, but most strangely, the result is that it changes the original record anyway! I've tried it a dozen times, just to make sure, but that is indeed what is happening. function copytest($id) { $this-Applicant-id = $id;

Re: Re: Copying a db record

2006-09-15 Thread Samuel DeVore
try function copytest($id) { $this-Applicant-id = $id; $this-data = $this-Applicant-read(); $this-Applicant-id = null; unset($this-data['Applicant']['id']); $this-data['Applicant']['schoolyear_id'] = 16;

Re: Copying a db record

2006-09-15 Thread Brian French
After you get the record, unset $this-Applicant-id: function copytest($id) { $this-Applicant-id = $id; $this-data = "" unset($this-data['Applicant']['id']); unset($this-Applicant-id = $id;); $this-data['Applicant']['schoolyear_id'] = 16;

Re: Copying a db record

2006-09-15 Thread [EMAIL PROTECTED]
Again, thanks for the replies guys. I do appreciate the help! Unfortunately, neither strategy worked, although they did show interesting results. Brian's method threw me errors. But Samuel's solution made the following happen: Record 1 remains unchanged. Record 2 created, with the new

Re: Copying a db record

2006-09-15 Thread nate
Sounds like something else is going wrong. Try pasting your full controller code along with a schema dump of the relevant tables to http://cakephp.org/pastes/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake

Re: Copying a db record

2006-09-15 Thread [EMAIL PROTECTED]
Thanks - it has been pasted. http://www.cakephp.org/pastes/show/d2e1f32e5bcb2e920a6b1f377027a6a7 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to

Re: Re: Copying a db record

2006-09-15 Thread Samuel DeVore
save takes the associated array either $this-Applicant-save($this-data); or $this-Applicant-save(array('Applicant',$this-data['Applicant')); On 9/15/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks - it has been pasted.

Re: Copying a db record

2006-09-15 Thread [EMAIL PROTECTED]
Thanks for keeping at it! This option: $this-Applicant-save(array('Applicant',$this-data['Applicant'])); didn't make any changes to the database. This option: $this-Applicant-save($this-data); produced the same results as before, 1 good copy of the record, sandwiched between 2 new empty

Re: Copying a db record

2006-09-15 Thread Brian French
what is in the $this-data variable in the copytest function? Is it recursive? I cant remember off the top of my head... does read() return a recursive array? Would using something else like $this-Applicant-findById() possibly fix this? [EMAIL PROTECTED] wrote: Thanks for keeping at it!

Re: Copying a db record

2006-09-15 Thread [EMAIL PROTECTED]
I tried findById, with the same results. Here's the var_dump of $this-data using either method (read or findById): array(7) { [Applicant]= array(32) { [id]= string(0) [schoolyear_id]= int(15) [lastname]= string(6) Zoposc [firstname]= string(5) Oscar

Re: Copying a db record

2006-09-15 Thread Sohei Okamoto
What is your debug level? Can you turn it to higher and see if there is any warning?I haven't discovered exact cause yet, but I had some problem with excuting same page twicewhen there is session warning about sending header. Just in case.Sohei

Re: Copying a db record

2006-09-15 Thread [EMAIL PROTECTED]
Hi, Good idea. It doesn't show any warnings, though. And it only shows one INSERT statements as being executed, yet 3 records are still created. 1 DESC `applicants` 32 32 0 2 DESC `divisions`2 2 0 3 DESC `statuses`

Copying a db record

2006-09-14 Thread [EMAIL PROTECTED]
Let me apologize in advance - I'm very new to Cake and this simple problem is driving me crazy... I've looked all through the Wiki and tutorials looking for an example like this. I'd like to read a record from my database, change one or two of the fields, and then save it back as a *new* record