Results 1 to 4 of 4

Thread: [RESOLVED] MySQL Database Design for Advertising

  1. #1

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Resolved [RESOLVED] MySQL Database Design for Advertising

    First let me say that I am new at MySQL / PHP.

    I have a list of categories(18-20), each having sub-categories(15-40 / category). Also I have a list of headings from the yellow pages (about 4900).

    I am looking for guidance about how to set the database up, and how to allow the classified ad author to use the db to assign category / sub-category / headings. Any suggestions would be appreciated.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  2. #2

    Re: MySQL Database Design for Advertising

    What you could do is have a subscriber table which contains authentication information and a unique ID [call it subscriber_id]. Then, for each of the categories, include that subscriber_id as a FK. To link the sub-categories, link them to the main category via a FK, as well as the subscriber_id as a FK. This will allow you to have multiple categories and sub-categories of the same name, but with them linked to the subscriber_id as well, meaning it's all broken down. The same goes for headings; link them to the sub-category (FK) and subscriber_id (FK).

    If you need a better, or more detailed explanation, I'm more than happy to provide one.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: MySQL Database Design for Advertising

    I'd have a single table for categories... all sub categories and deeper levels (incl headings) would be in the same table. I'd then have a ParentID field... when it's NULL, that's your top-level categories. Sub-categories would then have the ID of the record to which it belongs.

    The ad would then have a categoryID ... which would point to this table... this allows an ad to appear at any level. If an ad can be in multiple categories or headings, then have a link table that sits between the Ad table and the Category table and has the AdID and the CategoryID.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: MySQL Database Design for Advertising

    I was certain that I replied to this... I did what techg suggested. Now if I can only figure out how to manipulate the cat / subcats on the fly... I guess java.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width