$tags = array();
while ($row = $stmt_tags->fetch(PDO::FETCH_ASSOC)) {
$tags[] =htmlspecialchars( $row['name'], ENT_NOQUOTES, 'UTF-8' );
}
echo implode(',', $tags);
$tags = array();
while ($row = $stmt_tags->fetch(PDO::FETCH_ASSOC)) {
$tags[] =htmlspecialchars( $row['name'], ENT_NOQUOTES, 'UTF-8' );
}
echo implode(',', $tags);