I’m having trouble with my PHP class. My professor gave us a code but it seems he did it incorrectly and it’s giving me an unexpected T_array error. I can’t figure out what he did wrong or how I can fix it to do my project. Here’s his code:
<?php
class Songs_model extends CI_Model{
public function __construct(){
parent::__construct();
$this->load->database();
}
public function get_songs($slug=null){
if ($slug==null){
$rs=$this->db->get('songs');
return $rs->result_array();
}else{
$rs=$this->db->get_where('songs'array('song_slug' => $slug));
return $rs->row_array();
}
}
}
?>
Any idea what’s wrong? The error states it’s on line 14:
$rs=$this->db->get_where('songs’array(‘song_slug’ => $slug));
Nothing I do works.