0) { mysql_connect ($dbhost, $dbuser, $dbpass) ; mysql_select_db ($dbname); $query = "select entry_keywords, entry_id, entry_blog_id, entry_title, entry_text, entry_status, date_format(entry_created_on, '%Y%m%d') as mtdate, date_format(entry_created_on, '%h.%i.%S') as mttime, date_format(entry_created_on, '%Y') as mtyear, date_format(entry_created_on, '%m') as mtmonth, date_format(entry_created_on, '%d') as mtday FROM mt_entry where entry_blog_id=$blogID AND entry_status=2 AND entry_keywords LIKE '%$tag%' ORDER BY entry_blog_id desc, $dateDisplay"; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); ## check for existing tags if (mysql_num_rows($result) < 1) { echo "
example.com / tags / $tag
<"; echo "We're sorry, but there are no items matching the tag $tag.
"; } else { ## loop through entries with tags echo "example.com / tags / $tag
"; echo "example.com / tags /
"; echo "Please enter some tags above.
"; } ?>