Skip to content

Instantly share code, notes, and snippets.

@tkjaergaard
Created August 17, 2012 11:39
Show Gist options
  • Select an option

  • Save tkjaergaard/3378213 to your computer and use it in GitHub Desktop.

Select an option

Save tkjaergaard/3378213 to your computer and use it in GitHub Desktop.
get attachment
public function get_attachments($id,$limit=FALSE,$type='prod')
{
if(!is_numeric($id)):
$this->error = 'We need a valid numeric ID number to get the attachments. provided: '.$id;
return false;
endif;
if( $limit && is_numeric($limit) ) $this->db->limit($limit);
// Let's define the $attr array
$attr = array(
'type' => $type,
'parent' => $id
);
$query = $this->db->get_where('xx_rdco_attachments', $attr);
if($query->num_rows() < 1):
$this->error = 'There is no attachments associated with to this id: '.$id;
return false;
endif;
return $query->result_array();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment