View Single Post
  #8  
Old May 5th, 2011, 08:58 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi

I think your query is completely wrong. I did this and it worked:

Code for theme's functions.php file:
PHP Code:
function dfr_get_brands() {
    global 
$wpdb;
    
$brands $wpdb->get_results("SELECT brand FROM ".$wpdb->prefix."dfr_shop_products GROUP BY brand");
    
$html '';
    foreach (
$brands as $brands) {
        
$html .= '<option value="'.$brands->brand.'">'.$brands->brand.'</option>';
    }
    return 
$html;

Code for your view:
HTML Code:
<form method="get">
	<select name="brand">
		<?php echo dfr_get_brands(); ?>
		<input type="submit" value="Go" />
	</select>
</form>