php - creating a list from two tables -
i have 2 tables in database:
table name: table1 table2 columns id1;name1 id2;name2;id1
i output nested list of items using php:
<ul> <li>item1 (from t1)</li> <li>item2 (from t1)</li> <li>item3 (from t1) <ul> <li>item1 (from t2 id1 -> item3)</li> <li>item2 (from t2 id1 -> item3)</li> </ul> </li> <li>item4 (from t1)</li> ... </ul>
i serverside welcome suggestions using css. many time.
tom
i reference site printing out results of sql query via php:
http://www.siteground.com/tutorials/php-mysql/display_table_data.htm
as sql query, suggested query doesn't match desired output since suggested html list has 3 items requested table1, suggested table1 has 2 items.
maybe this?
select t1.id1, t1.name1, t2.id2, t2.name2 dbo.table1 t1 left outer join dbo.table2 t2 on t1.id1 = t2.id1
that give "grid" output can read php , formatted list, suggested. it's 4 columns because 1 of 5 redundant.
Comments
Post a Comment