What you're looking for is AJAX. You can't add an elements' rel attribute value to an SQL query, that too on clicking of the element. What you can do is, send a request to a special page (or same page) to fetch the stuff from database.
Then, by using the response you can make changes on the body.
$(".some").click(function(){
var RelValue = $(this).attr('rel');
$.get("url_to_php_file", {value: RelValue}, function(data){
// Make changes on current page
});
});
An example of making the content of the clicked element to "loaded" when the AJAX response is received :
$(".some").click(function(){
var RelValue = $(this).attr('rel');
var t=$(this);
$.get("url_to_php_file", {value: RelValue}, function(data){
t.text("loaded");
});
});
See more about AJAX : https://api.jquery.com/jQuery.ajax/
See more about jQuery.get() : https://api.jquery.com/jQuery.get/