Added content to search.php, ordered by priority and written SQL command for joining tables