I am trying to create a simple tag cloud in PHP. The following is what I have so far but its not working because I have no idea what I'm doing.
For each record in the database, tags are stored like this: tag1,tag2,tag3 etc... So I have to somehow get the records first and them break then into individual tags and display them that way. Any help would be greatly appreciated.
// DB: get snippet tags
$get_snippet_tags = mysqli_query($conn, "SELECT Tags FROM snippets WHERE IsPublic = 1 LIMIT 20")
or die($dataaccess_error);
if(mysqli_num_rows($get_snippet_tags) > 0 )
{
while($row = mysqli_fetch_array($get_snippet_tags))
{
$snippet_tags = $row['Tags'];
// explode tags
$tags_array = array_map('string', $snippet_tags);
$cloud_tag = implode(", ", $tags_array);
// echo out resluts
echo '<a href="#">'.$tags_array.'</a>';
}
}
echo '<a href="#">'.$could_tag.'</a>';
and notecho '<a href="#">'.$tags_array.'</a>';
unless you plan to loop over them or something