Empty searchstring'; elseif ($_POST['tagname_like'] != '' && $_POST['tagname_is'] != '') $error = 'Only one field should be used for the search'; # How to look in the column $search = (empty($_POST['tagname_like'])) ? ' = \''.$wpdb->escape($_POST['tagname_is']).'\'' : ' LIKE \'%'.$wpdb->escape($_POST['tagname_like']).'%\''; if (trim($error) == '') $tags = $wpdb->get_results( "SELECT terms.name, terms.slug, taxonomy.count FROM $wpdb->terms AS terms INNER JOIN $wpdb->term_taxonomy AS taxonomy ON terms.term_id = taxonomy.term_id WHERE taxonomy.taxonomy = 'post_tag' AND terms.name {$search} AND taxonomy.count <> 0 ORDER BY ".$_POST['order_by'].' '.$_POST['tag_sort'], OBJECT); } # Default form $str .= '
'; # If the submit button is hit if (@isset($tags)){ # Show results (count) $str .= ''. count($tags) .' tags found'; # Ordered list (numbered) $str .= '