I have a select statement. It selects all my tags from a database. Each tag is an entry so when the query gets results they come out as tag1tag2tag3 if echoed within the while statement. When I echo the results outside the while statement I get tag3. I would like to get tag1,tag2,tag3 as a result. What is the best way to approach this?
$sql = "SELECT name FROM tags WHERE vid_id=?";
$gettags = $conn->prepare($sql);
$result=$gettags->execute(array($vid_id));
while ($row=$gettags->fetch(PDO::FETCH_ASSOC)){
$tags=$row['name'];
}
echo $tags; //produces tag3 if entries are tag1tag2tag3