Results 1 to 4 of 4

Thread: [RESOLVED] MySQL Database Design for Advertising

  1. #1
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 07
    Location
    Pointless Forest 38.517,-92.023
    Posts
    7,207

    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 ---
    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein
    "They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety." Benjamin Franklin

  2. #2
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 08
    Location
    On the Internet
    Posts
    2,845

    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 02
    Posts
    21,655

    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 subscribe to all threads I participate, so there's no need to pm when there's an update.*
    *Proof positive that searching the forums does work: View Thread *
    * 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??? *
    * Use Offensive Programming, not Defensive Programming. * On Error Resume Next is error ignoring, not error handling(tm).
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN

  4. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 07
    Location
    Pointless Forest 38.517,-92.023
    Posts
    7,207

    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 ---
    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein
    "They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety." Benjamin Franklin

Posting Permissions

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