Hi all;
I have a simple question which has to do with displaying information in a grid:
I have two relational tables which needs to instead of displaying the coulmns id code it needs to display the corresponding columns info.
For instance this is how it looks:
id | category | name
---------------------
1 | 1 | first
2 | 2 | second
3 | 3 | third
4 | 4 | fourth
and this is how i need it to look:
id | category | name
---------------------
1 | type a | first
2 | type b | second
3 | type c | third
4 | type d | fourth
Hopefully you understand what I mean, as I can't seem to find the correct query syntax for this particlur problem.
THanks all
[SOLVED] php display grid
Moderator: General Moderators
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
Re: php display grid
No, I don't understand what you mean.reiqwan wrote:Hopefully you understand what I mean
Can you please make it clear where you want to display this
EDIT: If displaying on a webpage you can output them in tables to format them in columnar form
explanation
I have two tables in mysql db:
the one is called category -> and has the following columns:
id - category - name
and my other table called files -> has the following columns:
id - categoryid - filename
when i add info to the files table instead of putting the actual name of the category into the category column i put the id of that category into the categoryid column in the files table.
Now when I request the rows of data from my files table I want it to show the category name instead of the categoryid.
How would I do this?
Hopefully that has set sufficient light on the issue.
THanks again
the one is called category -> and has the following columns:
id - category - name
and my other table called files -> has the following columns:
id - categoryid - filename
when i add info to the files table instead of putting the actual name of the category into the category column i put the id of that category into the categoryid column in the files table.
Now when I request the rows of data from my files table I want it to show the category name instead of the categoryid.
How would I do this?
Hopefully that has set sufficient light on the issue.
THanks again
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
Code: Select all
SELECT files.id, category.name, files.filename FROM category, files WHERE category.id = files.categoryid