ben_is_happy Posted June 9, 2011 Share Posted June 9, 2011 Hi everyone, I am creating a print site with various printing items. I am planning out the site and I have a few issues that I need help with. With every product that I sell (be it business cards, flyers, posters etc) I need to have either a check box / tick box for an option to have a design made. Each of the designs varies in price according to item (business cards, flyers, posters etc). How would I go about planning this out in the database, so that they match the correct product? I hope this makes sense to someone? Thanks inadvance, Ben. Link to comment Share on other sites More sharing options...
Jonathon Posted June 9, 2011 Share Posted June 9, 2011 Assign the checkbox an id and use this id when the form is posted to retrieve the item. Would be one way. 1 Link to comment Share on other sites More sharing options...
HartleySan Posted June 10, 2011 Share Posted June 10, 2011 I don't know the details of what you're thinking, but maybe something like the following: 1) Have a table for categories (i.e., business cards, flyers, posters, etc.). 2) Have another table for specific items, which would contain a foreign key that links to the IDs in the categories table. 3) Have a third table for designs. The designs table would have specific information about the various designs, and also contain a foreign key, linking the table to the IDs of the categories table. You would then need to use joins to combine data for queries. This is, of course, very similar to Larry's second example site in the book, so basing everything off of that and using stored procedures, etc. would probably be beneficial. Anyway, depending on a variety of things, you may need to adjust my overgeneralization, but I think that's a starting point. What do you think? Edit: And like Jonathon said, you'd have to assign the proper values to each of the check boxes by making the appropriate query on page load, and setting the appropriate IDs, etc. to the check boxes. 1 Link to comment Share on other sites More sharing options...
ben_is_happy Posted June 10, 2011 Author Share Posted June 10, 2011 Dear Jonathon and HartleySan, Thank you for helping me, I have enjoyed read your posts back to me. Here is a link of what I mean: http://www.stationery-direct.co.uk/business-card-printing.php I forgot that I have printing options too which vary on each item! Thanks again for the help, Ben. Link to comment Share on other sites More sharing options...
ben_is_happy Posted June 11, 2011 Author Share Posted June 11, 2011 Hey everyone, I have another question about this. Could I not just put the item in the database manually with the design linked to the item? Sorry if I sound stupid, I am still learning. Thanks, Ben. Link to comment Share on other sites More sharing options...
HartleySan Posted June 11, 2011 Share Posted June 11, 2011 Well, the printing options work the same way as anything else. If the print options are unique to each item, I suppose you could keep the print option in the items table. Otherwise, make a separate table, and then link to it using foreign keys. That's kinda up to you, I think. I cannot understand your last question though. What do you mean by "Could I not just put the item in the database manually with the design linked to the item"? 1 Link to comment Share on other sites More sharing options...
Matt Posted June 13, 2011 Share Posted June 13, 2011 What do you mean by "Could I not just put the item in the database manually with the design linked to the item"? I think what he means, and I may be wrong, is he want's to store all the different print items in one table, the custom designs in another table, and then link them in an 'orders' table with foregin keys. Is this what you were saying Ben? 1 Link to comment Share on other sites More sharing options...
ben_is_happy Posted June 13, 2011 Author Share Posted June 13, 2011 Hello HartleySan and Matt, Thank you for posting back to me. Sorry for not posting back sooner. I am sorry as I have not been sure I have been clear enough. Matt has hit the nail on the head. That is correct Matt, that is how I want the database. I think my inexperience has made this harder to explain, I think. All I want to do is be able to add a print item and add a design item for the corresponding print item. I think what Matt has said is correct and will read more on this. If anyone could suggest any ideas or another design I would very grateful. Thank you for helping me out, Ben Link to comment Share on other sites More sharing options...
HartleySan Posted June 13, 2011 Share Posted June 13, 2011 Again, it depends on what the print items apply to. Are the print items dependent on the categories or the individual items? Whichever one it is, that's the one you have to place a foreign key to in the print items table. Make sense? 1 Link to comment Share on other sites More sharing options...
Recommended Posts