This is the codeigniter controller statement to get the data from mysql
$result = $this->db->select("GROUP_CONCAT(Service_name SEPARATOR ', ' ) AS service_names")
->where('Service_boid', $boId)
->get('service');
Here the problem is, a syntax error in mysql because while echoed the query:
SELECT GROUP_CONCAT(Service_name SEPARATOR ', `'` ) AS service_names FROM (`service_info`) WHERE `Service_boid` = '4'
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '
) AS service_names FROM (service_info) WHEREService_boid` = '4' at line 1
An unwanted character is appending to the separator as shown above. Other than direct query execution (sql query is executing through mysqli_query()) any solution to solve this?
Note : I want ', ' as the separator.