Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 920709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:45:44+00:00 2026-05-15T18:45:44+00:00

When i try to a edit a entry.. its creating a duplicate entry in

  • 0

When i try to a edit a entry.. its creating a duplicate entry in the database.

i have made sure i add an hidden id field when i go to the edit form.

Restaurant

RestaurantAttribute

RestaurantContact

these are the models i am using.

tried reinitialize the id

$this->Restaurant->id = $this->Restaurant->id;

strange… in the db the extra entry is not there…

but in cake its displaying..tried to clear the cache.. still happening

http://harshamv.com/files/screenshots/2010-07-07_1524.png

http://harshamv.com/files/screenshots/2010-07-07_1525.png

i have posted the code here

http://forum.phpvideotutorials.com/showthread.php?p=81936

here is the index action http://bin.cakephp.org/view/660872993

here is the model http://bin.cakephp.org/view/1228539627

http://harshamv.com/files/screenshots/2010-07-10_0937.png

SQL Statement http://pastebin.com/EmdXmNeH

Restaurant Model http://pastebin.com/W1sLiL7W

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:45:44+00:00Added an answer on May 15, 2026 at 6:45 pm

    I got the answer from teknoid from the MIRC.

    In my edit view i have only set the Restaurant.id.
    none of the ids of the related models are set in the view.

    By cake’s convention we need to have the id of any record from the db u update. so this was creating a duplicate record in the related models.

    In the index action since there is a JOIN of related models. it was creating duplicate entries because of repeated entries in the related model

    by adding the ids of all the related model records. this solved the problem.

    Thanks all for your time. Finally i managed to get it working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used the ploneformgen for creating the input form. When I try to
Okay I edit my question, try to explain it more clearly: I have a
I made a small project where i try to change the name from edit
I have a data entry form that had several comboboxes on it. Each of
I have a webpage with a form that is used to edit some object.
Edit: This is conflicting when I try @NiftyDude's addition. Most pages: $(blockquote).appendTo(.entry); <div class=entry>
Whenever I try to edit existing or create new distribution provisioning profile on iOS
When I try to edit a build, mostly just to schedule it, visual studio
When I try to edit texts in my iPhone application ( UITextfield ), it
When I try to EDIT a tennis court... I get this exception :System.Data.UpdateException; Unable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.