Insert the results of aa SQL query into HTML or RXML.
<sqloutput> works like all output tags. By default
anything within #'s will be interpreted as a variable. Thus #column#
will be replaced by the column value. ## will be replaced by a #. The
inserted SQL results will by default be HTML quoted, < will for
example be quoted to <. See the formoutput page for more
information about quoting.
The <sqloutput> tag will copy its contents and replace the
columns for each row in the result of the query. If the result is
empty, the <sqloutput> will not return anything.
Within the <sqloutput> the column values can be accessed
as other variables. This is useful for transferring the result
to normal RXML variables.
Attributes
- host=database
-
Which database to connect to, usually a symbolic name. If omitted the
default database will be used.
- query=SQL query
-
The actual SQL-query.
- quiet
-
Do not show any errors in the page, in case the query fails.
- parse
-
If specified, the query will be parsed by the RXML parser. Useful if
you wish to dynamically build the query.
Example
<table>
<tr>
<th>Country</th>
<th>Population</th>
</tr>
<sqloutput host=test
query="SELECT country, population FROM countries ORDER BY country">
<tr>
<td>#country#</td>
<td>#population#</td>
</tr>
</sqloutput>
</table>
Country |
Population |
#country# |
#population# |
<sqloutput host=test
query="SELECT population FROM countries WHERE country='Sweden'">
<set variable=swepop other=population>
</sqloutput>
The population of Sweden is <insert variable=swepop>.
The population of Sweden is .
|