Today was quite a fun day for coding stuff. Managed to continue adding further functions on the podcasting section. This included assigning tags to podcasts, adding new tags in a tag table, and tricks to make the tagging look nicer.
Learnt a few new tricks on [tag]php[/tag] today too, this included doing comma separated lists from database queries. Instead of echoing them one by one in the while loop, all you do is create a string and slowly add the next item onto the string. The items were followed by a comma to make them separated, but the end will have a comma as well, this is where a quick sub_str function comes into play, it trims the string to whatever you want it to be, in this case we want it to simply trim the last bit
heres an example
$query = "SELECT *
FROM tags";
$result = mysql_query($query,$dblink) or die('Query failed: ' . mysql_error());
while ($line = mysql_fetch_array($result,MYSQL_ASSOC)) {
$currenttags .= $line['tag'] . “, “;
}
echo substr($currenttags,0,-2);
So yeah, lots of [tag]php[/tag] porn up there, hoping to learn some more from kev.
drop a message