Hello, Im trying to develop my project so that layers can be separated.
One thing Im trying to do is to populate Unordered Lists.
For example:
Code:
<ul>Fruit</ul>
<li>Apples</li>
<li>Oranges</li>
</ul>
<ul>Vegetables</ul>
<li>Corn</li>
<li>Spinach</li>
</ul>
I want to do this from the database and I think the best methodology would be to use XSLT. However, Im not 100% certain.
My table layouts for this sort of example would look something like the following:
FoodTypes
------------
FoodTypeID (auto_increment PK)
FoodTypeDescription
Foods
-------
FoodID (auto_increment PK)
FoodDescription
FoodTypeID (FK)
My select statement would be like the following:
Code:
select ft.FoodTypeDescription, f.FoodID, f.FoodDescription
from Foods f
join FoodTypes ft
on f.FoodTypeID = ft.FoodTypeID
My output therefore would look something like the following:
Fruit, 1, Oranges
Vegetables, 2, Corn
Fruit, 3, Apples
Vegetables, 4, Spinach
How would I go about taking the data from my SQL query and transforming it into these unordered lists? I want to do this without having to use an Order By clause in my SQL statement so that I separate the data and presentation layers.
I found this example in ASP.NET, but Im looking for the PHP equivalent or whatever the best solution is: http://forums.asp.net/t/1104154.aspx
Hello, Im trying to develop my project so that layers can be separated.
One thing Im trying to do is to populate Unordered Lists.
For example:
Code:
<ul>Fruit</ul>
<li>Apples</li>
<li>Oranges</li>
</ul>
<ul>Vegetables</ul>
<li>Corn</li>
<li>Spinach</li>
</ul>
I want to do this from the database and I think the best methodology would be to use XSLT. However, Im not 100% certain.
My table layouts for this sort of example would look something like the following:
FoodTypes
------------
FoodTypeID (auto_increment PK)
FoodTypeDescription
Foods
-------
FoodID (auto_increment PK)
FoodDescription
FoodTypeID (FK)
My select statement would be like the following:
Code:
select ft.FoodTypeDescription, f.FoodID, f.FoodDescription
from Foods f
join FoodTypes ft
on f.FoodTypeID = ft.FoodTypeID
My output therefore would look something like the following:
Fruit, 1, Oranges
Vegetables, 2, Corn
Fruit, 3, Apples
Vegetables, 4, Spinach
How would I go about taking the data from my SQL query and transforming it into these unordered lists? I want to do this without having to use an Order By clause in my SQL statement so that I separate the data and presentation layers.
I found this example in ASP.NET, but Im looking for the PHP equivalent or whatever the best solution is: http://forums.asp.net/t/1104154.aspx
|
|
Search Webmaster Help and Solution
Data Sets and XSLTRelated ItemsQuery failed: connection to localhost:3354 failed (errno=111, msg=Connection refused). |
