<?php
session_start
();
include(
"database_odbc.php");
include(
"func.php");
?>
<html><!-- #BeginTemplate "/Templates/template.dwt" -->
<head>
<!-- #BeginEditable "doctitle" --> 
<title>MusicWeb: Your Music. Your Way</title>
<!-- #EndEditable --> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="641" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td width="640"> 
      <table width="640" border="0" cellspacing="0" cellpadding="2" bgcolor="#8080C0">
        <tr> 
          <td width="338"><img src="studio2/images/musicweblogo2.gif" width="316" height="83"></td>
          <td width="294" valign="top"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="3" height="80">
              <tr align="right" valign="top"> 
                <td> 
                  <p><font face="Tahoma,Arial,Helvetica" size="2"><b><?php print date("F d, Y"); ?><br>
                    </b></font></p>
                  <p>&nbsp;</p>
                  </td>
              </tr>
              <tr align="right" valign="bottom"> 
                <td height="30"> 
                  <table border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td align="right"><a href="viewcart.php"><img src="studio2/images/view.gif" width="55" height="16" border="0"></a></td>
                      <td><img src="studio2/images/numitems.gif" width="111" height="13"></td>
                      <td><?php include("counter.php"); ?></td>
                    </tr>
                  </table>
                  
                </td>
              </tr>
            </table>
            
          </td>
        </tr>
      </table>
      <table width="640" border="0" cellspacing="0" cellpadding="0">
        <tr bgcolor="#000000"> 
          <td width="11%"><img src="studio2/images/spcr_1x1.gif" width="1" height="1"></td>
          <td width="89%"><img src="studio2/images/spcr_1x1.gif" width="1" height="1"></td>
        </tr>
        <tr> 
          <td width="11%" bgcolor="#008000"> 
            <p bgcolor="#0000CC"><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif"><img src="studio2/images/cdcdover1.jpg" width="71" height="71"></font></p>
          </td>
          <td width="89%" bgcolor="#008000">
            <table width="100%" border="0" cellspacing="0" cellpadding="5">
              <tr>
                <td><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" bgcolor="#0000CC"><i><font size="2">Enjoy 
                  deep discounts on hundreds of songs from up-and-coming stars. 
                  Build $7.99 or $9.99 CDs, click on SPECIAL when you see it. 
                  The <b>MusicWeb</b> Clearance Sale ends May 1, 2002 at 11:59 
                  p.m. so buy your bargains today!</font></i></font></td>
              </tr>
            </table>
            <font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" bgcolor="#0000CC"><i></i></font></td>
        </tr>
      </table>
      <table width="640" border="0" cellspacing="0" cellpadding="0">
        <tr bgcolor="#000000"> 
          <td width="125"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="5">
              <tr> 
                <td><img src="studio2/images/explore.gif" width="70" height="23"></td>
              </tr>
            </table>
          </td>
          <td width="4">&nbsp;</td>
          <td background="studio2/images/dashes.gif" width="1"><img src="studio2/images/spcr_1x1.gif"></td>
          <td width="5">&nbsp;</td>
          <td width="505"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="5">
              <tr> 
                <td> 
                  <div align="right"><img src="studio2/images/musicnews.gif" width="108" height="23"></div>
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr> 
          <td width="125" valign="top" bgcolor="#CCCCCC"><?php toc(); ?></td>
          <td width="4" bgcolor="#CCCCCC">&nbsp;</td>
          <td background="studio2/images/dashes.gif" width="1"><img src="studio2/images/spcr_1x1.gif"></td>
          <td width="5" >&nbsp;</td>
          <td width="505" valign="top"> <!-- #BeginEditable "content" -->
<?php

# Function to list products by artist.  See similar function to list by category.

function list_products$artist "" ) {
    global 
$category$REQUEST_URI$notify
    
    
$sql "SELECT Song.SongTitle, Song.SongPrice, Artist.ArtistName ".
           
"FROM Song, Artist, Collection WHERE Artist.ArtistName = '".
           
str_replace("_"," ",$artist).
           
"' AND Song.SongTitle = Collection.SongTitle AND ".
           
"Collection.ArtistName = Artist.ArtistName";        
           
    
$result db_query($sql);
    if( !
$result ) return FALSE;
    else 
    {
        print 
'<br><h1>'.$notify.'</h1>'.
              
'<table width="95%" border="1" cellspacing="0" cellpadding="2">'.
              
'<th width="25%">Artist</th>'.
              
'<th width="40%">Song Title</th>'.
              
'<th width="10%">Price</th>'.
              
'<th width="25%">&nbsp;</th>'.
              
'</tr>';
                  
        while(
odbc_fetch_row($result)) 
        {
            
$title odbc_result($result,"SongTitle");            
            
$id str_replace(" ","_",$title);
            
$price odbc_result($result,"SongPrice"); 
            
$name odbc_result($result,"ArtistName");
            
$artistid str_replace(" ","_",$name);            
            
            print 
'<form method="post" action="'.$REQUEST_URI.'"><tr>'.
                  
'<td width="20%">
                  <a href="by_artist.php?artist='
.$artistid.'&category='.$category.'">'.
                  
$name.'</a></td>'.        
                  
'<td width="40%">
                  <a href="song_description.php?song='
.$id.'&category='.$category.'">'.
                  
$title.'</a></td>'.
                  
'<td width="15%" align="center"> $'.number_format($price,2,".",",").' </td>'.
                  
'<td width="25%" align="center">'.
                  
'<input type="hidden" name="ProductID" value="'.$id.'">'.
                  
'<input type="submit" name="addtocart" value="Add to Cart">'.
                  
'</td>'.
                  
'</tr></form>';
        }
        print 
"</table>";        
        return 
TRUE;
    }    
}

list_products($artist);
?>
<!-- #EndEditable --> 
            <p>&nbsp;</p>
          </td>
        </tr>
      </table>
      <table width="640" border="0" cellspacing="0" cellpadding="5">
        <tr bgcolor="#008000"> 
          <td>&nbsp; </td>
        </tr>
        <tr> 
          <td> 
            <p><font size="2">&copy; MusicWeb, a Rensselaer Polytechnic Institute 
              Company.<br>
              MusicWeb and related marks are trademarks of Rensselaer Polytechnic 
              Institute. ALL RIGHTS RESERVED</font> </p>
          </td>
        </tr>
      </table>
    </td>
    <td background="studio2/images/dashes.gif" width="1"><img src="studio2/images/spcr_1x1.gif" width="1" height="1"></td>
  </tr>
  <tr>
    <td width="640" background="studio2/images/hdashes.gif"><img src="studio2/images/spcr_1x1.gif" width="1" height="1"></td>
    <td background="studio2/images/dashes.gif" width="1"><img src="studio2/images/spcr_1x1.gif" width="1" height="1"></td>
  </tr>
</table>
</body>
<!-- #EndTemplate --></html>