return to first page linux journal archive
keywordscontents
<HTML>

<HEAD>
<TITLE>WebSmith's Concerts-we'd-like-to-see Database</TITLE>
</HEAD>

<BODY BGCOLOR=#FFFFFF>

<H1>WebSmith's Concerts-we'd-like-to-see Database</H1>
<hr>

<H2>Master Concert Listing Sorted by the
<! msql print "$sortby"> field
</H2>

<!-- Connect to the "concerts" database -->
<! msql connect >
<! msql database concerts >

<!-- Issue the query, here we are
 selecting all records ("*") from the
 "listings" table, placing the results in
   a query handle called "q1".
   This query handle will be used below to display the data. -->
<! msql query "select * from listings order by $sortby" q1>

<!-- Let's put the data in a table, it looks nicer -->

<TABLE border=1>

<!-- Some simple header info for the table -->

<TR>
	<TH>SHOWDATE</TH>
	<TH>HEADLINER</TH>
	<TH>OPENING ACT</TH>
	<TH>LOCATION</TH>
	<TH>PRICE</TH>
</TR>

<!-- Here is where we have w3-msql display all the data retrieved from
   the query stored in the query handle "q1". Note the mixture of
   HTML and mSQL commands. Here, we are simply building a table "row"
	 for every database "row" retrieved in the query. -->

<! msql print_rows q1
	"<TR>\
	<TD><font size=-1>@q1.0</font></TD>
	<TD><font size=-1>@q1.1</font></TD>
	<TD><font size=-1>@q1.2</font></TD>
	<TD><font size=-1>@q1.3</font></TD>
	<TD><font size=-1>@q1.4</font></TD>
	</TR>">>>>>>>>;

<!-- When we are done, let's close the table properly -->

</TABLE>

<!-- Free up the query handle - we are done with it -->
<! msql free q1>

</BODY>
</HTML>