In my database field, authors of a particular item are listed by ID like this:
AuthorID: 1,4,7
Since there is no space between comma-separated values in the DB, my page would display this:- Jeff Smith,Peter Thompson,Euphegenia Doubtfire
How do I edit my code to show this instead?:- Jeff Smith, Peter Thompson, Euphegenia Doubtfire
For some reason I cannot crack this, many thanks for your help.
$authors = explode(",", $value );
$value = '';
foreach ($authors as $au){
$elements = ((strpos($au, ",") === false) ? array(0 => $au) : (explode(",", $au)));
$index = 0;
foreach ($elements as $element) {$value .= (($index++ === 0) ? '' : ',') . '<a href="/site/tracks_list.php?q=(AuthorID~contains~'. $element . ')">'. $element . '</a>';
}
}