SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Apr 2006
    Location
    London, United Kingdom
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I don't know how to tackle this problem!

    I am currently working on a project. Simply put it's a mix between ebay and gumtree. I want users to be able to post listings of different categories, and each category will need different data stored about each listing.

    How do I go about structuring this? I am currently using a main listings table in the database and further separate tables (that are linked by foreign ID) to the main table to contain the other fields.

    When a user wants to create a listing however, I initially have a dropdown so a category can be chosen, but after that it all becomes a nightmare, since the add listing form will be different for each category, do I just a separate form for each and a separate PHP form handler or is there a more integrated and efficient way to go about it?
    eFlair Design | Premium Design Services and Web Consultation

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,021
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    you want us to figure out for you what data you want to store?

    that's a bit unrealistic, i'd say

    how about you try to create the structure, put all the columns in that you need to store, work on your one-to-many relationships, and then show us what you got

    as it stands now, your question is far too nebulous
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Addict
    Join Date
    Apr 2006
    Location
    London, United Kingdom
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I want to know how to dynamically output the correct fields of the form for each category. Each category will have different data stored as well as similar data, so each add and edit form will be different. I was asking if there was a more efficient method than just having a separate form and separate PHP handler file for each form.

    I actually posted this in the PHP forum but it seems to have been moved
    eFlair Design | Premium Design Services and Web Consultation

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,021
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    actually you cross-posted into both forums, and a moderator made a decision to close the php thread and leave this one open

    now you will have to ask the moderators (via the little red flag on the left) to move this thread over

    see the trouble you cause yourself when you cross-post?

    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,051
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    If you do not know the columns an entity will have EAV is what your after. Though, its probably best to stay away and get a better understanding of the data you need to work with as already recommended. Meta data really goes against the primary benefit of a relational database. There are other databases that are more for storing meta data, a relational database really isn't it. Can it be done, yes. In fact wordpress, drupal,magento and I'm sure countless other systems do it. is it a gigantic, convoluted mess – yes. To put things in perspective EAV is a SQL anti-pattern. Bets to udnerstand the data your working with and create a concrete schema based on it.
    The only code I hate more than my own is everyone else's.


Bookmarks

Posting Permissions

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