anchor.diff:  	  }
   	}
   
  -	//Version 1, designed to be slightly easier by creating a view first, and then checking if id in view.
  -
  -/*
  -	String createView = "CREATE OR REPLACE VIEW SUBSCRIBED_SENSORS AS SELECT DISTINCT sub.sensor_id  FROM subscriptions sub WHERE sub.person_id = " + pid;
  -
  -	String queryAudio = "SELECT Distinct a.recording_id, a.sensor_id, a.date_created, a.length, a.description FROM sensors sen, audio_recordings a, subscribed_sensors WHERE a.sensor_id in (select * from subscribed_sensors)";
  -	String queryImage = "SELECT Distinct i.image_id, i.sensor_id, i.date_created, i.description FROM sensors sen, images i, subscribed_sensors WHERE i.sensor_id in (select * from subscribed_sensors)";
  -	String queryScalar = "SELECT Distinct s.id, s.sensor_id, s.date_created, s.value FROM sensors sen, scalar_data s, subscribed_sensors WHERE s.sensor_id in (select * from subscribed_sensors)";
  -*/	
  -	//Version 2. Goes through subscriptions itself.
  -	//Had to insert brackets before the WHERE, and around query sensor.
  -	//Had to remove these brackets.
  +	//Starts the query and checks to make sure data is attached to a subscribed sensor.
   	String queryAudio = "SELECT Distinct a.recording_id, a.sensor_id, a.date_created, a.length, a.description FROM sensors sen, audio_recordings a WHERE a.sensor_id in (SELECT sensor_id FROM subscriptions WHERE person_id = "+pid+")";
   	String queryImage = "SELECT Distinct i.image_id, i.sensor_id, i.date_created, i.description FROM sensors sen, images i WHERE i.sensor_id in (SELECT sensor_id FROM subscriptions WHERE person_id = "+pid+")";
   	String queryScalar = "SELECT Distinct s.id, s.sensor_id, s.date_created, s.value FROM sensors sen, scalar_data s WHERE s.sensor_id in (SELECT sensor_id FROM subscriptions WHERE person_id = "+pid+")";
  -
  -	//Check if the associated sensor is found as well. 
  -	//String querySensor = "(SELECT Distinct sen.sensor_id FROM sensors sen WHERE sen.sensor_ID IN (SELECT sensor_id FROM subscriptions WHERE person_id = "+pid+")";
  -
  - 
  -
  -//Currently does not select any blop fields. Easily added when we have test data that has it. 
  +	//After creating the opening query, the code then adds additional checks via AND statements to the query, based on provided search parameters.
  +
  +
  +
  +
  +	//Adds a check to make sure that the data's attached sensor is of the required type.
   	if (sensorType != null && !sensorType.isEmpty()) {
   	   	%>type is <%= sensorType%>, <%
  -	   //sensorType = "AND sen.sensor_id = a.sensor_id AND sen.sensor_type = "+ sensorType;
  +
   	   sensorType.toLowerCase();
   	   queryAudio = queryAudio + " AND sen.sensor_id = a.sensor_id AND sen.sensor_type = '"+ sensorType+"'";
   	   queryImage = queryImage + " AND sen.sensor_id = i.sensor_id AND sen.sensor_type = '"+ sensorType+"'";
  
positive.code: 	     String value;
  	
  %>
  
  <br>
  <p><u>AUDIO RESULTS</u></p>
  <table style="border-style:inset";>
  
negative.code: 	   //querySensor = querySensor + " And sen.location = '"+ location+"'";
  
  	}
      	//Adds a check to make sure that the data has the exact keywords string match, OR that its sensor attached sensor does.
  	if (keywords != null && !keywords.isEmpty()) {
  		%>contains the keyword' <%= keywords%>', <%
  
   	   //queryAudio = queryAudio + " AND a.description LIKE '%"+keywords+"%'";
   	   //queryImage = queryImage + " AND i.description LIKE '%"+keywords+"%'";
  	   queryAudio = queryAudio + " AND sen.sensor_id = a.sensor_id AND (a.description = '"+keywords+"' OR sen.description = '"+ keywords+"')";
  