// art_list - produce a table of all listings, or those that match @req

#cgivar req, ord

#setifnotgiven ord = artist


#set TITLE = "Available art listings"
#include top

<center>
<a href="?rtn=art_menu">Back to art demo home</a>

<br>
<br>



<table cellpadding=2>
<tr bgcolor=FFFFEC align=center><td>Artist</td><td>Title</td><td>Format</td><td>Year</td><td>Edit/delete</td></tr>

#sql 
  select * from examp_art
  #if @req != ""
    where title contains "@req" or artist contains "@req" 
  #endif
  order by @ord
#endsql

#while $sqlrow() = 0
  <tr bgcolor=FFFFFF>
  <td><a href="?rtn=art_details&id=@id">@artist</a></td>
  <td><a href="?rtn=art_details&id=@id">@title</td>
  <td>@format</td><td>@year_created</td>
  <td><a href="?rtn=art_details&id=@id">Edit/delete</a></td>
  </tr>
#endloop

#if $sqlrowcount() = 0
  <h2>Nothing found.</h2>
#endif
