items as $item) { //exists already? $link_exists_check = "select count(*) from bookmarks where link LIKE '".mysql_real_escape_string($item['link'])."' and tag LIKE '".mysql_real_escape_string($_GET['tag'])."'"; $link_exists_check_result = mysql_query($link_exists_check) or die(mysql_error()); //if no rows were returned then add the link to the database if (!mysql_result($link_exists_check_result,0)) { $bookmark_insert_query ="insert into bookmarks ( tag, link, title, description, dc_date ) values ( '".mysql_real_escape_string($_GET['tag'])."', '".mysql_real_escape_string($item['link'])."', '".mysql_real_escape_string($item['title'])."', '".mysql_real_escape_string($item['description'])."', '".mysql_real_escape_string($item['dc']['date'])."' );"; mysql_query($bookmark_insert_query) or die(mysql_error()); } } //select the last NUM_RSS_ITEMS added and output a new feed $bookmarks_select_query = "select * from bookmarks where tag='".mysql_real_escape_string($_GET['tag'])."' order by id desc limit ".NUM_RSS_ITEMS.""; $bookmarks_select_results = mysql_query($bookmarks_select_query) or die(mysql_error()); //setup the headers header ("Content-type: text/xml"); // Output file as XML echo ("\n"); //standard RSS 2.0 bits including dc ?> del.icio.us/tag/<?php echo $_GET['tag']; ?> - filtered http://del.icio.us/tag/ Filtered tag feed for the del.icio.us tag. while ($this_bookmark = mysql_fetch_assoc($bookmarks_select_results)) { ?> @http://del.icio.us/tag/ <?php echo sanitize_for_xml($this_bookmark['title']); ?> ' ), array ( '&' , '"', ''' , '<' , '>' ), $final ); } //close the database connection mysql_close($link); ?>