Hello, In my database I have tags for items but i need it to turn tag0, tag1, tag2, tag3, tag4, tag5, tag6 HTML: into <a href="/tag/tag0">tag0</a>, <a href="/tag/tag1">tag2</a>, <a href="/tag/tag3">tag3</a>, <a href="/tag/tag4">tag4</a>, <a href="/tag/tag5">tag5</a> HTML:
It shouldnt be too hard to do that, no tested this, you might have to fiddle with it a little bit <?php # first of all select your tags from your database - you havent given your table structure so this part is up to you $sql = "SELECT tag from yourtagstable"; $query = mysql_query($sql); $count = 0; while ($result = mysql_fetch_assoc($query)) { $count++; print "<a href=\"/tag/{$result['tag']}\">{$result['tag']}</a>"; if($count != mysql_num_rows($query)) print ", "; } ?> PHP:
I've been thinking about implementing tags on my site for awhile now too. Check out this tutorial, it might help: http://www.itnewb.com/v/Comprehensive-Guide-to-PHP-MySQL-Tag-Clouds-Includes-Demo