Skip to content

Instantly share code, notes, and snippets.

@ken-muturi
Last active August 29, 2015 14:01
Show Gist options
  • Save ken-muturi/db08d7f57b7d882fab9d to your computer and use it in GitHub Desktop.
Save ken-muturi/db08d7f57b7d882fab9d to your computer and use it in GitHub Desktop.
group concat
<?php
$sql_query = array();
foreach ($select_columns as $column)
{
$sql_query [] = "( SELECT group_concat( DISTINCT $column ) FROM $master_grid_section_table WHERE 1 {$_search_filter_query} {$created_by} {$denied_data_entries} ) as $column";
}
if( $result = $this->db->query("SELECT ". join(', ', $sql_query )))
{
return $result;
}
else
{
log_message('error', "DB Error: (".$this->db->_error_number().") ".$this->db->_error_message(). ' Path: '.$this->uri->uri_string());
show_error('<p>A database error has occurred, a notification about this error has been sent to tech support.</p>');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment