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 6807567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:50:54+00:00 2026-05-26T19:50:54+00:00

I am working on a project in CakePHP 1.3 which will store a collection

  • 0

I am working on a project in CakePHP 1.3 which will store a collection of members – each with a forename and surname – and multiple results for each member which will store the date, a reference to the member and also the number of points.

The database structure is shown below.

CREATE TABLE `members` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `forename` varchar(255) NOT NULL,
  `surname` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE `results` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `member_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `points` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `member_id` (`member_id`)
);

The application is working for entering each member’s details one by one, which is fine – but I need to have an “Add Results” page which will list each of the members in the database and allow a numerical value to be entered for the number of points that member has been given. Each time results are added, they will all be for the same date, and each member will always get points, even if it is 0.

Can someone please give me a pointer on how to display a form that conforms to the above specification, and how to store multiple rows at the same time?

Thanks in advance.

  • 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-26T19:50:55+00:00Added an answer on May 26, 2026 at 7:50 pm

    Since you are new to cake… here are a few tips. use pr($this->data) in your controller to see exactly what data you are receiving when the form is submitted.

    give your input fields naming conventions like this data[YourModel][field] so for example you would change <input name="points[]" type="text" /> to <input name="data[Result][points]" type="text" /> then in the controller it will be accessible by

     pr($this->data['Result']['points']);
    

    SAVING TO MULTIPLE MODELS

    you may find it easiest to give access to both models from the current controller so at the top of your controller add this

    class ResultsController extends AppController {   
     var $uses = array('Member', 'Result');
    

    now you can save whatever data you want to whatever model you want like so.

    $dataForResults = array();
    $dataForResults['Result']['points'] = $this->data['Result']['points'];
    $this->Result->save($dataForResults);
    

    this doesn’t necessarily retrieve a record from the database, edit it and then put it back, this will create a new record.

    to edit a record it will be more like,

    $dataByMemberId = $this->Result->findByMemberId($data['Result']['member_id']);
    $dataByMemberId['Result']['points'] = $this->data['Result']['points'];
    $this->Result->save($dataByMemberId);
    

    that will get the current record of that member in the Results table, edit the points entry and then resubmit it back in it’s location in the database.

    A little winded but should get you started.

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

Sidebar

Related Questions

I've just started working on an existing CakePHP project. I will be developing a
I am working on a CakePHP project that has a database populated from multiple
I'm working in a project that is divided into multiple modules. Each module have
I'm working on a CakePHP project and am currently building the user authentication part
I am working on project in Linux which involves 1) Static Lib in C++
So i'm working with CakePHP v1.2.5. On my current project, I decided to start
I am working on a project in CakePHP. When we want to update a
I was working locally on my computer on a cakephp project for 3 days.
I'm using CakePHP 1.3 version for this project. I am working with Auth for
I am working on a project in which I define ID inside of a

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.