SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: Dynamic Rows
-
Jun 19, 2004, 17:42 #1
Dynamic Rows
I am having a problem because usually when I carry out mysql queries it is only in one table.
But this time I will be using "SELECT * from $membername"
My only problem is that this means that the rows will be different for each table because the member can chose to have different rows.
So how can I parse this out attractively in php? It's easy for me if I know what rows I'm dealing with, I just do something like:
NAME | AGE
-----------------------------------
$ROW['name'] | $ROW['age']
But in this case I know what rows I'm dealing with. I will be parsing it out into a table and each row will be in a different column, how will It know how many columns there are, and the names of these columns. Also how will it know what to put into the $ROW[''] variable as this will be different for each member?
As you can see I am slightly confused, mabye this isn't even possible but I think it may be.
I would appreciate any help offered.
-
Jun 20, 2004, 07:12 #2
- Join Date
- Jan 2004
- Location
- Uppsala, sverige
- Posts
- 700
- Mentioned
- 2 Post(s)
- Tagged
- 1 Thread(s)
I would say that your problem is your database design. You shouldn't have different tables for different member. Use one table for all members which contains all common attributes. For the individual attributes you can use two additional tables with the layout
attribute
----------
attribute
description
memberAttributes
----------------
Member -- foreign key to member table
Attribute -- foreign key attribute table
attributeValue
Bookmarks