Welcome, Guest
Username: Password: Remember me

TOPIC: FK's and One to Many relationships with Authoring

FK's and One to Many relationships with Authoring 14 Apr 2012 10:48 #1987

  • edwardcox
  • edwardcox's Avatar
  • Offline
  • Premium Member
  • Here to help.
  • Posts: 131
  • Thank you received: 26
  • Karma: 12
Hi All,

Just looking for best way to do this please:

Table 1 - Clients (has all client details), there will be Many Clients.

Table 2 - Quotes (has ALL quotes 'Quotations for Time and Labor'), there will be Many Quotes.

I see a One to Many relationship where One Client can have Many Quotes, so would that imply that the Client Table should have a Foreign Key link to Quotes OR should the Quotes have a Foreign Key linked to a Client?

Ideally using Authoring only the Quotes for a Registered user will appear to them when logged in and I'm sure that is OK. However, whichever way I go it would seem I have to let the User either Select a Quote that belongs to them alone - Or Display Quotes and then when entering each new the User would have to select their OWN user linked to the Quote. And they are both messy as I'd rather it was 'invisible' or automatic.

Hope that's not too confusing.

Any ideas please?

Regards,

Edward.
Passionate Joomla! Developer and J-Cook pro evangelist.
www.jcombuilder.com - we build great Joomla!® Components so you don't have to.
The administrator has disabled public write access.

Re: FK's and One to Many relationships with Authoring 15 Apr 2012 13:34 #1999

  • jeffreyray
  • jeffreyray's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Thank you received: 2
  • Karma: 0
You are asking about some pretty basic table design stuff. I recommend you try doing a little reading before asking this kind of question. By spending a little bit of time learning this stuff, you will save yourself and other people a lot of time and frustration, and ultimately build better components than you would otherwise . I recommend PHP & MySQL by Head First. ( www.google.com/search?q=head+first+php+%26+mysql+pdf )
Last Edit: 15 Apr 2012 13:35 by jeffreyray.
The administrator has disabled public write access.

Re: FK's and One to Many relationships with Authoring 16 Apr 2012 08:15 #2018

  • edwardcox
  • edwardcox's Avatar
  • Offline
  • Premium Member
  • Here to help.
  • Posts: 131
  • Thank you received: 26
  • Karma: 12
jeffreyray wrote:
You are asking about some pretty basic table design stuff. I recommend you try doing a little reading before asking this kind of question. By spending a little bit of time learning this stuff, you will save yourself and other people a lot of time and frustration, and ultimately build better components than you would otherwise . I recommend PHP & MySQL by Head First. ( www.google.com/search?q=head+first+php+%26+mysql+pdf )

jeffreyray; I find your posting offensive (personally) and insulting given that indeed I do have a high level understanding of both SQL and most importantly J-Cook.

My question was specifically related to how I might accomplish a task within J-Cook given certain limitations. People such as yourself that think they are expert 'moderators' should keep their opinions to themselves in future before offending others. Just putting it out there mate.
Passionate Joomla! Developer and J-Cook pro evangelist.
www.jcombuilder.com - we build great Joomla!® Components so you don't have to.
The administrator has disabled public write access.
The following user(s) said Thank You: devil

Re: FK's and One to Many relationships with Authoring 16 Apr 2012 11:09 #2019

  • jeffreyray
  • jeffreyray's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Thank you received: 2
  • Karma: 0
Edward, if you are offended you really need to get over your ego.

This isn't a J-Cook question - it's table design question. The answer would be the same whether you were using J-Cook or not. Since you are obviously refusing to expend any effort to find the answer yourself, and would rather rely on others:

The answer is that your quotes table should have a foreign key linking to your clients table.

That is *THE* design pattern for one-to-many relationships.

In J-Cook and everywhere else.

I am sorry that you are offended, but if that is something that isn't glaringly apparent to you, then my recommendation still stands. Do some brushing up on your sql/table design.
The administrator has disabled public write access.

Re: FK's and One to Many relationships with Authoring 16 Apr 2012 13:09 #2021

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
@jeffreyray,

Please accept if somebody is offended.
When somebody express its feelings, just take it and first all all, express some TRUE apologizes.

Good developer or not, Cook Self Service is for beginners. Even if I work alone, I take time for this.

There are no questions more important than others. The only boring questions on the forum are these wich re asked 3 times when people don't make some searches before.

By the way, edward is really helping on the forum and related lot of issues. (And also paid the service)
So, please be fine here, or I will close this topic.

Thanks in advance.

By the way, thank you very much for your second post that explains the way how to do. This is a good behavior.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: edwardcox

Re: FK's and One to Many relationships with Authoring 16 Apr 2012 13:58 #2023

  • jeffreyray
  • jeffreyray's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Thank you received: 2
  • Karma: 0
My intention wasn't to offend, only to help, or I would not be posting at all.

My personal opinion is that his question was best answered by sending him to a good resource that covers such topics. I myself was not prepared to give a thorough explanation of WHY the answer is what it is, but truly "why" is more important than the answer itself.

Give a man a fish and he will eat for a day, teach a man to fish and he will eat for a lifetime.

That was my intention.

I'm not much for sugar-coating. If you interpreted my blunt language in my original post as being an attack, please don't.
Last Edit: 16 Apr 2012 14:19 by jeffreyray.
The administrator has disabled public write access.
The following user(s) said Thank You: admin, edwardcox

Re: FK's and One to Many relationships with Authoring 16 Apr 2012 14:25 #2024

  • jeffreyray
  • jeffreyray's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Thank you received: 2
  • Karma: 0
I don not wish to further this dialog, as it is not on topic with the posters question, I just felt it necessary to state my position.
Last Edit: 16 Apr 2012 14:25 by jeffreyray.
The administrator has disabled public write access.

Re: FK's and One to Many relationships with Authoring 24 Apr 2012 11:42 #2117

Jeffrey,

I get your point and I agree with you, I have employees who often ask questions that should seem common sense for their field and with that said I often have to give the simple answer as I grumble under my breath... Sometimes I point them to the path to finding the solution and sometimes I give the answer with explanation... and sometimes I give the answer and laugh when they palmslap their forehead.

I know you where trying to point him in the right direction and by no means is that a bad thing, it is more often good than bad but where I could see that it was taken offensively was by pointing out how basic it was and suggesting that he was wasting everyone's time by posting the question. Now not to offend you but, this is a forum and it wastes the time of no one, it just sits here idly awaiting for a beginner to stumble upon it and find a quick solution when they may have a deadline. Or maybe its just a kick to unclog your mind-block and for some reason today you just cant remember Sh*t.... either way it isn't a nuisance for the question to be posted here as it may have taken you 2 seconds to read it and if you preferred to do so you could have just skipped over it.

You how ever have something bigger in your heart, the drive to help other people and so you posted the correct answer and I am sure there will be many who benefit and appreciate your for that! In the end I'm sure maybe it was just a frustrating day or it simply may be that you are just that blunt and straight forward. but remember... you did it because you wanted to help and some times being blunt isn't helping, being blunt may just detour someone from developing their skills and desire to be a developer. And I know because you do help... that isn't your goal!

Just a few thoughts from someone who has the same mind set as you!

To Edward: Please keep in mind that every developers frustration or bluntness is not a direct attack on you, a lot of people have worked hard to get where they are and personally I agree that hands on experience is the best way to make something stick when you are learning which is why you will often come across people who will just point in the direction to the right answer...

He could have left out a few sentences but what he said was correct... research the options for table relations because where he gave you a correct answer... there are many more options to what you want to do and only you know the correct route...

Good luck in furthering your knowledge and development skills and thank you for supporting "cook" as much as you have!


jeffreyray wrote:
My intention wasn't to offend, only to help, or I would not be posting at all.

My personal opinion is that his question was best answered by sending him to a good resource that covers such topics. I myself was not prepared to give a thorough explanation of WHY the answer is what it is, but truly "why" is more important than the answer itself.

Give a man a fish and he will eat for a day, teach a man to fish and he will eat for a lifetime.

That was my intention.

I'm not much for sugar-coating. If you interpreted my blunt language in my original post as being an attack, please don't.
Last Edit: 24 Apr 2012 11:45 by fentontech.
The administrator has disabled public write access.
Time to create page: 0.162 seconds

Get Started