Last active
August 29, 2015 14:01
-
-
Save ken-muturi/db08d7f57b7d882fab9d to your computer and use it in GitHub Desktop.
group concat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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