View Single Post
  #4  
Old May 2nd, 2011, 08:39 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Something like this should work:

HTML Code:
<?php
//Function to Get Brands
function dfr_get_brands() {
	global $wpdb;
	$merchants = $wpdb->get_results("SELECT DISTINCT p.brand FROM ".$wpdb->prefix."dfr_shop_products p, ".$wpdb->prefix."wp_dfr_shop_p2c pc, ".$wpdb->prefix."wp_dfr_shop_cats c AND pc.cat_id = c.id AND c.name = \'Woks\' ORDER BY c.name, p.brand");
	$html = '';
	foreach ($brands as $brands) {
		$html .= '<option value="'.$brands->brand.'">'.$brands->brand.'</option>';
	}
	return $html;
}
?>





<!-- code for your vuew -->
<form method="get">
	<span>
		<?php echo dfr_get_brands(); ?>
		<input type="submit" value="Go" />
	</span>
</form>