P2P | IT Discussions Forum

Full Version: Queries
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.


Furthermore, a bit more explanation:

Well basically, posts from forms are stored in a table under each members name.

Each members form can be different and therefore will have different columns.

E.g. One member might have Email and Name fields in his table whereas another member might have only an Age field.

But I want to parse this out onto the one page using "SELECT * from $membername"

But then how do i use php to display the titles of the fields eg .. Name, Age, Email and then put the correct content under it.

Eg for member 1 i would need it to say

Name | Email
-----------------------------
John | john@jon.com
Peter | peter@web.com

And if member 2 was to view this page I would want it to display his table, with his headers so it should look like:

Age
-----
31
67
32
13

Is this possible what I want to achieve ,and do you have any ideas on how to achieve it?
Reference URL's