Create an array for a tag cloud in PHP

Everyone tells us how to create a tag cloud with an array.. but how to actually create the array with the data that we fetch from our database? This is how I do it. The table we are working in is “pictures” and the field with the tags is “tags“....