  <?php
    define('IN_BANDTOPIA', "You're here!!!");
    ini_set("display_errors","1");
    error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);	
	include_once('include/pageStart.php');
	
    $userID=$_SESSION['UserId'];
	
    $query = "SELECT FirstName FROM Users WHERE UserId = $userID";
    $result = mysql_query($query, $mydb) or die(mysql_error() . "<br>" . $query);
    $row = mysql_fetch_array($result);	
	
    print('<h1>Welcome '.$row['FirstName'].'</h1>');

	//this connects to search page to find bands
	print('<form method="post" action="bandfinder.php">');
	print('<input type="hidden" name="userId" value="'.$userID.'" />');	
	print('<table><tr><td><input type="text" name="artist" size="25" /></td>');
	print('<td><input type="submit" value="Search" /></td></tr></table>');
	print('</form>');
	
	
	
	//this displays users favorite bands
    $query = "SELECT ArtistId FROM FavArtists WHERE UserId = $userID";
    $result = mysql_query($query, $mydb) or die(mysql_error() . "<br>" . $query);
	print("<div style=\"height:120px;width:250px;overflow-y:scroll;\">");	
	while($row=mysql_fetch_array($result)) {
	 $query = "SELECT Name FROM Artists WHERE ArtistId = $row[0]";
     $res = mysql_query($query, $mydb) or die(mysql_error() . "<br>" . $query);
     $r = mysql_fetch_array($res);
     $name = $r[0];	 
     print("<a href=\"../index.php?action=artistdisplay&aID=".$row[0]."\">".$name."</a><br>");
    }
    print("</div>");

    //THIS IS WHERE THE 411 ON THE UPCOMING EVENTS MUST BE DISPLAYED
	//$query = "SELECT Name FROM UpcomingEvents WHERE upcoming - now > 1 month
	//print("<div style=\"height:120px;width:250px;overflow-y:scroll;\">");
     //<a href=\"bandpublic.php?artistID=$row['artistId']\">Band Name & Upcoming Event</a></div>");	
    //print("</div>");
  
    mysqli_close($mydb);
  ?>
