Page 1 of 1

multiple items for one service problem

Posted: Mon Feb 07, 2011 1:43 pm
by ezi_pro
how can i make a mysql database that supports a
1. title
2. then a list of services the user inputs that is then displayed

the problem im running into is that how can i sync the title with the possibly infinite number of services.

i want each service to be individual

would i have to create a seperate table for the services?

maybe i could create a table with the auto increment ID then the title
then another table that has the ID of the corresponding first table with the quotes

so it would look like this

service title table:
(auto increment id,
service title)

service list table:
(id from first table,
services)

so then how would i get a query that would pull these tables together?

Re: multiple items for one service problem

Posted: Mon Feb 07, 2011 2:00 pm
by AbraCadaver
Seems like you're on the right track. I would add a unique id for the service as well:
[text]service_title
id
title

service_list
id
title_id
service[/text]
[text]SELECT * FROM service_title, service_list WHERE service_title.id = service_list.title_id[/text]

Re: multiple items for one service problem

Posted: Tue Feb 08, 2011 2:43 am
by ezi_pro
AbraCadaver wrote:Seems like you're on the right track. I would add a unique id for the service as well:
[text]service_title
id
title

service_list
id
title_id
service[/text]
[text]SELECT * FROM service_title, service_list WHERE service_title.id = service_list.title_id[/text]

Thanks for the query, looks good:)

ill try it out when i get the time, ive been busy with h/w lately

ill post my code up here soon

Edit - btw the id on the service list was a good call, that way i can edit each service individually as well:)