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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:47:52+00:00 2026-06-11T00:47:52+00:00

I’m creating a tournament-platform with CakePHP. Currently I’ve created the following tables, models and

  • 0

I’m creating a tournament-platform with CakePHP. Currently I’ve created the following tables, models and controller which work perfectly: Tournaments, Users, and Teams.

I’ve created a “Tournamentuser” table, controller & model as well, where the tournament_id, user_id and team_id is stored.

Then when using View.ctp under Tournaments, it should display the User.Username & Team.Username in relation to the Tournamentuser. As of now, I have only managed to retrieve the id’s from the table via. a foreach(.. as ..). I can see in the CakePHP query that it retrieves the data, I just don’t know how to print it.

  • 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-06-11T00:47:53+00:00Added an answer on June 11, 2026 at 12:47 am

    I suppose you already know this but in CakePHP the conventions are:

    • models must have singular name: user/car/image
    • controllers must have plural name: users/cars/images
    • tables must have plural name: users/cars/images

    If for example we need a relation: tournament-user we must follow the conventions(in CakePHP 2+):

    • controller: TournamentsUsersController.php
    • model: TournamentsUser.php
    • table: tournaments_users

    If all the above conventions are followed before you can have your relation, tournaments-users you must define the relation between the two tables.

    Here you can find more details on how to do this: http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html

    If everything is done correctly until this point, you can now query the TournamentsUser Model.

    Assuming you are in TournamentsUsersController.php controller:

    $data = $this->TournamentsUser->find('all');
    

    You can now see what $data contains using:

    debug($data);
    

    For printing the data you can use either a for/foreach loops:

    $size = count($data);
    for($i=0; $i<$size; ++i) {
       debug($data[$i]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
I have a text area in my form which accepts all possible characters from

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.