simcoweb Posted March 4, 2007 Share Posted March 4, 2007 I'm creating a classified ads system for a client. There will basically be 6 types of ads: Services Housing Jobs Personals Gigs For Sale Each has it's own set of questions in the registration form but there are also some common questions. For example, all have these: Title Location Price Description Email Email Use (3 choices on how the people would respond) The 'Housing' ads have price but the 'Jobs' ads use compensation as the title. Some ads allow images like housing, personals, and for sale. But jobs, services and gigs do not. The question I have is about structure. Should I have one table called 'ads' that holds all these fields and deal with the insert queries accordingly. Or, should I have separate tables for each kind of ad so that the queries are specific to that table? There would need to be a few 'connected' fields as well that would be present in all the tables. They would be: ad_id cat_id subcat_id confirmation_status (I will be requiring that they 'activate' the ad by responding to a link. Default is 0 while activated would be 1) date_created date_expired I'm looking for some guidance about the most efficient way to construct this from anyone who has had experience with this type of thing. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Snooble Posted March 4, 2007 Share Posted March 4, 2007 i would use a seperate table per division. and an extra for your cat id etc. The more tables the merryer. as with the registration, just make a switch statement, checking what division the user is part of. Therefore getting echo'd the correct forms. Snooble. (Big project, like building 6 sites!) Quote Link to comment Share on other sites More sharing options...
simcoweb Posted March 5, 2007 Author Share Posted March 5, 2007 Snooble, thanks for your post and suggestions. Initially that's the way I had it set up...multiple tables. One table for each 'type' of ad. That means, though, that I need to create 6 separate form parsing scripts. Although they are similar they have the slightest differences. Once I get the 'master' form done then the others could be derived from it. Ok, so in the ad registration, basically the way it would work is kind of like adding your site to Yahoo or DMOZ where first you have to navigate to the sub-category and then the Post Your Ad link will be there. I can snag what sub-cat it is via the $_GET in the URL. With your suggestion, then, you'd say using a switch statement at that point would then determine what form shows. Is that what you meant? Quote Link to comment Share on other sites More sharing options...
simcoweb Posted March 5, 2007 Author Share Posted March 5, 2007 Also, in a 'switch' statement can I use functions in the case parameters? Example, please? Quote Link to comment Share on other sites More sharing options...
btherl Posted March 5, 2007 Share Posted March 5, 2007 You can't use functions in a switch. Instead, just use if/then/else, which is equivalent to switch. Quote Link to comment Share on other sites More sharing options...
simcoweb Posted March 5, 2007 Author Share Posted March 5, 2007 Ok, 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.