Is there a way to get MySQL to return a value with a comma? I have this MySQL query which returns values with 5 digits, for example 14123, but I want it to be 14.123. I read something about the FORMAT()
function but I'm not really sure how to use it together with my query, and I want to avoid using PHP.
My query looks like this:
public function artists_count_get()
{
$this->load->database();
$sql = "SELECT COUNT( DISTINCT artist_id ) AS artists FROM artists";
$query = $this->db->query($sql);
$data = $query->result();
if($data) {
$this->response($data, 200);
} else {
$this->response(array('error' => 'There was an error'), 404);
}
}