Q:

Create URL for view in Codeigniter

I need to generate an url link for a view and display data from database into this view. My main view is Artists/Singers and it has a table of singers. Each singer should be a link which when I press leads me to his Artist page with his albums, biography and songs. 
I need to do this in Code Igniter and of course I can read the docs but will need a week or so and I have only 2 days.
Here is my code:
    $this->load->database();

    $artists = $this->db->query('SELECT a.name, a.date, c.name FROM artist as a, country as c WHERE a.country_id=c.id'); 

    echo "<tr><td>Artist</td><td>Year</td><td>Country</td></tr>";

    foreach ($artists->result() as $row)
    {
        //echo $config['base_url'];
        echo "<tr>";
        echo "<td><a href=\"/Artist.php\">" . $row->name . "</a></td>";
        echo "<td>" . $row->date . "</td>";
        echo "<td>" . $row->name . "</td>";
        echo "</tr>";
    }
    echo "</table>";

A:

I would do some thing like this
$autoload['libraries'] = array('database');
$autoload['helper'] = array('url');

Model
Example_model.php
<?php

class Example_model extends CI_Model {

public function getArtist() {
    $artists = $this->db->query('SELECT a.artist_id,a.name, a.date, c.name FROM artist as a, country as c WHERE a.country_id=c.id'); 
    return $artists->result();
}

}

Controller Example
<?php

class Example extends CI_Controller {

  public function __construct() {
     parent::__construct();
     $this->load->model('example_model');
  }

  public function index() {
     $data['artist'] = $this->example_model->getArtist();

     $this->load->view('example_view', $data);
  }

}

Then on view
<?php foreach($artist as $row) {?>
<tr>
<td><?php echo anchor('artist/' . $row->artist_id,  $row->name, array('target' => '_blank'));?></td>";
<td>$row->date</td>
<td>$row->name</td>
</tr>
<?php }?>

Then on routes
$route['artist/(:any)'] = "controller/function/$1";

