Displaying Query Results as a Table
Ответ
Task
We need to display list of the results of a query to Joomla! database as a table.
Solution
Set the DW Anything module settings as follows.
| Setting | Value | Description |
|---|---|---|
| SQL Query |
SELECT * FROM `#__users` |
Enter SQL query to retreive the list of user names from Joomla! users table. Note that you can use standard Joomla! '#_' prefix for database table names |
| Header HTML |
<table>
<thead>
<tr>
<th>Name</th>
<th>User Name</th>
</tr>
</thead>
<tbody>
|
Enter HTML code to display before the resulting list of data rows. Table opening tag and column headers go here. Add column headers as required |
| Template |
<tr>
<td>{name}</td>
<td>{username}</td>
</tr> |
Enter HTML code to display each data row returned by SQL query. To insert data field, type it's name enclosed within curly barckets ({}). Add fields for all data columns you want to display here |
| Footer HTML |
</tbody> </table> |
Enter HTML code to display after the resulting list of data rows. Place table closing HTML tags here |
Result
| Name | User Name |
|---|---|
| john | John Smith |
| mary | Mary Brown |



Добавить комментарий