<html>
<body BGCOLOR="#ffffff" LINK="#0000ff" ALINK="#ff0000" TEXT="#000000">

<!-- connect to the database and get recipe information -->
<tcl>
package require sql

set conn [sql connect]
sql selectdb $conn test

set select "select * from recipe where id=1"
set nrows [sql query $conn $select]
set row [sql fetchrow $conn]

# get the fields out of the returned row.
set idx 0
foreach field {id course calories name description} {
	set $field [lindex $row $idx]
	incr idx
}
</tcl>

<center><h2><tcl>puts $name</tcl></h2></center>
<blockquote>
<tcl>puts $description</tcl>
</blockquote>

<!-- Ingredients --------------------------------------- -->
<table border=0 bgcolor=yellow width=100%><tr><td>
<h3>Ingredients:</h3>
<ul>
<tcl>
set select "select * from ingredients where rec_id=1"
set nrows [sql query $conn $select]

while {[set row [sql fetchrow $conn]] != ""} {
	set quantity [lindex $row 1]
	set name     [lindex $row 2]
</tcl>

<li><b><tcl>puts $name</tcl></b><i><tcl>puts $quantity</tcl></i><br>

<tcl>
# end of while loop for ingredients
}
</tcl>

</ul></td></tr></table>

<!-- Prepartion ----------------------------------------- -->
<table border=0 bgcolor=lightblue width=100%><tr><td>
<h3>Preparation:</h3>
<ol>
<tcl>
set select "select * from prep where rec_id=1 order by step_num"
set nrows [sql query $conn $select]

while {[set row [sql fetchrow $conn]] != ""} {
	set descr    [lindex $row 2]
</tcl>

<li><tcl>puts $descr</tcl>

<tcl>
# end of while loop for ingredients
}
</tcl>

</ol></td></tr></table>


</body>
</html>
