Home How to echo results with join names from another table using nl2br
Reply: 0

How to echo results with join names from another table using nl2br

user1001
1#
user1001 Published in July 17, 2018, 9:40 am

I know how to echo results that are in an array using the following

nl2br(str_replace(',', "\n", $row['column-name']))

I now have a column in which the listed items (separated by commas) are id numbers that correspond to another table.

How can I echo these results and apply the name associated to that item relative to its id?

I have tried INNER JOIN but I seem to be missing how to perform this correctly.

'SELECT * FROM Table1 
 INNER JOIN Table2 ON Table1.ColumnName = Table2.ColumnID
 INNER JOIN Table3 ON Table1.ColumnID2 = Table3.ColumnID2 <-- This needs to apply names to the number-ids split by the nl2br
 ORDER BY OrderColumn'

<span>'.nl2br(str_replace(',', "\n", $row['table3-column-name-to-replace-table1-columnID2'])).'</span>

Thanks for your help.

This is the expected result. https://drive.google.com/file/d/1ChGv9qHeJPgtwVcxbqj8ey-1RjVTah28/view?usp=sharing

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.312887 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO