Jump to content

help with table/fields structure


ahabcaptain

Recommended Posts

Hi guys, ( i think i posted this in the wrong place first so i'm moving it here.)

 

I'm having a little trouble with getting a dynamic fields concept working for a php/mysql project i'm working on.

 

I made a container structure so when you open up a "container" via php in browser you get all the tables that container owns .. using a simple OwnerID structure a container can own tables and/or other containers. when you open up a container i present the child containers in a sidebar and the tables center view in tabs.. looks very clean and neat.. but i'm having trouble with the tables.. i want the structure to be totally dynamic from the php..

 

i want the tables to have dynamically assignable fields.. so you may create a table called ex "Italian Pasta" or "Vlan Table" and then you have 5-6 types of varchar fields and a few numberic fields etc.. and then you might want to add a field later on or remove a field..

 

the php will need to read out dynamically based on the amount of fields etc.. and how i do that is totally based on how the table structure will look.. and i'm having trouble with the table structure..

 

i want to create new tables on the fly.. so if you want to call the containers "Company:" "Location:" etc.. and then make a vlan database or vrf database for a routing company that'd be easy as pie also..

 

the approaches i have tried;

 

--- multiple tables ---

i made a view that lets the user create a new table phpMyAdmin style with preset field types and simple instructions etc.. and then an edit of each table..

 

this works like a charm, but two reasons this feel wrong;

 

1) you possibly end up with loooooads of tables and i find that messy

2) making a view statement to dynamicallly include unknown fields seems totally impossible.. and that means i'll manually have to populate a search database and i'd like to avoid that.

 

--- single table ---

 

i tried creating one table.. that has

 

ID + RowID + RowName + RowData + OwnerID etc..

 

so effectively building multiple tables ontop of a single table.. but i feel this isn't very scalable since you need multiple consecutive loops/querys to retrieve a single table and it just feels wrong ..

 

but view works like a charm here..

 

.....

 

so i ask.. how can i make dynamically allocateable tables that is scalable and effective and you can still use view for a search table..

 

or am i thinking this wrong somehow? at least it doesn't feel like MySQL or any other database for that matter seems to want to do what i want.. :)

 

hope this was clear enough..

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.