How to display data linked by foreign key to mapping table?

Well, in your query you give the s_id field new name (or alias) subcategory_id (the s_id as subcategory_id part in the query) but in your code you still try to access it by the name s_id Try $subcat = $row"subcategory_id" Or drop the alias from query. Similar stuff with ss_id field Try something like SELECT SC. Subcategory_name , SS.

Subsubcategory_name FROM Sub_subsub M JOIN Subcategory SC ON(SC. Subcategory_id = M. S_id) JOIN Subsubcategory SS ON(SS.

Subsubcategory_id = M. Ss_id) to get name pairs instead of ID pairs BTW your table design looks somewhat suspicious... usually this kind of category hierarcy is done with only one table, something like TABLE TAB_Category ( UID PRIMARY KEY, Parent FK REFERENCES TAB_Category(UID) ON UPDATE CASCADE, Name ) where root items do have Parent = NULL.

Well, in your query you give the s_id field new name (or alias) subcategory_id (the s_id as subcategory_id part in the query) but in your code you still try to access it by the name s_id. Try $subcat = $row"subcategory_id"; Or drop the alias from query. Similar stuff with ss_id field.

Try something like SELECT SC. Subcategory_name , SS. Subsubcategory_name FROM Sub_subsub M JOIN Subcategory SC ON(SC.

Subcategory_id = M. S_id) JOIN Subsubcategory SS ON(SS. Subsubcategory_id = M.

Ss_id) to get name pairs instead of ID pairs. BTW your table design looks somewhat suspicious... usually this kind of category hierarcy is done with only one table, something like TABLE TAB_Category ( UID PRIMARY KEY, Parent FK REFERENCES TAB_Category(UID) ON UPDATE CASCADE, Name ); where root items do have Parent = NULL.

Cool! That displays the id numbers from the correct fields in my mapping table but how do I then rather than display the numbers, display data from the table its linked to such as subcategory_name? – Richard Bell Jul 29 at 10:26 I can't use a single table as I have a many to many relationship going on.

– Richard Bell Jul 29 at 10:31 Well, you have to query the name, something like SELECT Subcategory_name FROM Subcategory WHERE subcategory_id = {$subcat}. But getting the names one by one in this manner is probably going to be slow... – ain Jul 29 at 10:33 @Richard See the updated answer, added query (untested, typed into editor! ) to get name pairs instead of ID pairs.

– ain Jul 29 at 10:43 thanks for your input. I'll have a play around with what you have told me and let you know what I come up with. – Richard Bell Jul 29 at 11:14.

Data is displaied on your blog without having to modify the core files. What ever methods you do not override use the default method in the Walker class that you Extend. Display Data.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions