dc_jt Posted November 9, 2006 Share Posted November 9, 2006 HiI have a table called listings which contains name, address, telephone etc of each advertising listing.Each listing has a choice of 4 types (Listing Ad, Quarter Size, Half Size, Full Size).Each listing only has one type.What is the best way to insert one of these types into my listings table?I was thinking of having a checkbox for each on my form like:Listing Ad []Quarter Size []Half Size []Full Size []Then whatever one is clicked goes into the table listings.However, do i have a separate table for the types or do i put them all in the listings table, im not sure?Hope someone can help asap pleaseThanks Quote Link to comment Share on other sites More sharing options...
trq Posted November 9, 2006 Share Posted November 9, 2006 I would have a seperate table for listing types. eg;[code]CREATE TABLE listing_types ( id INTEGER PRIMARY KEY, type_name VARCHAR(80))[/code]Populate it with data. eg;[code]1 Listing Ad2 Quarter Size3 Half Size4 Full Size[/code]Then, in listings have a field called listing type which is populated with the number corrisponding to the type selected. Quote Link to comment Share on other sites More sharing options...
dc_jt Posted November 9, 2006 Author Share Posted November 9, 2006 Yeah I thought that was the best way.Now from my form, I have an AddListing function which inserts name, address, telephone etc into the listings table so do I just run another function which inserts the listing type and the listing id in the listing type table?Do I have to join them using INNER JOIN or anything?Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.