Code Igniter truly rocks

Its been a couple years since I moved away from Classic ASP development and it’s code snippets like this that truly showcase the beauty of using a well designed framework to code with.  Check out this wicked query in Code Igniter:

function get_popular_songs() {   $this->db->select(‘listens.total_listens’); $this->db->select(‘albums.slug AS album_slug’); $this->db->select(‘artists.slug’); $this->db->select(‘songs.*’); $this->db->from(‘listens’);
$this->db->join(‘songs’, ‘songs.id = listens.song_id’, ‘left’); $this->db->join(‘albums’, ‘songs.album_id = albums.id’, ‘left’); $this->db->join(‘artists’, ‘songs.artist_id = artists.id’, ‘left’); $this->db->orderby(‘listens.total_listens’, ‘desc’); $this->db->limit(10);
$return = $this->db->get(); }
 

I’d hate to imagine how confusing writing this SQL statement by hand would be in Classic ASP. Ouch!

 


About Joseph R. B. Taylor

is a designer/developer who makes stuff for screens of all shapes and sizes. He currently works at Edvisors, Inc. where he creates screen-based experiences for used by millions of college students every year.

Wanna Talk?

Contact Me