$s = $_POST['submitterms'];
$querystr = "
SELECT $wpdb->terms.*
FROM $wpdb->terms
WHERE
lower($wpdb->terms.name) like '%$s%'
";
$pageposts = $wpdb->get_results($querystr, OBJECT);
echo '<ul>';
$x = 0;
while ($pageposts[$x]) {
$post = $pageposts[$x];
echo '<li>';
echo '<a href="' . $post->term_id . '">' . $post->name . '</a>';
echo '</li>';
$x++;
}
echo '</ul>';
I'm able to get term names that contains the characters i typed into the text box.
But what i want to do is changing term_id AS id AND name AS value so that i can pass the variables like:
$post->id
$post->value
//i.e
echo '<a href="'.$post->id.'">'.$post->value.'</a>';
I guess i need to change the MySQL code. What should I do?