DB query not working...
Posted: Wed Sep 07, 2011 5:48 pm
Can anyone tell me what I'm doing wrong with this bit of code? I'm fairly sure that it's something to do with the 2nd line but I can't get it to work. If it makes a difference, this is conducted when a visitor clicks a link that's coded to conduct this specific search.
Thanks in advance!
Thanks in advance!
Code: Select all
if ($_GET['service_category'] == 'Services for Senior Related Businesses'){
$search_results = $wpdb->get_results("SELECT * FROM wp_network_members WHERE wp_network_categories = 'Services for Senior Related Businesses' AND pub_status = 'publish'");
echo '<h1>Search Results</h1>' . "\n";
foreach ($search_results as $value) {
if (empty($value->profile_photo)) {
$value->profile_photo = "/wp-content/plugins/wp-members-network/images/no-photo.jpg";
}
echo '
<div class="networksearchitem"><br />
<a href="/' . $network_page . '/' . strtolower($value->f_name) . '-' . sanitize_title($value->l_name) . '/"><img src="' . $value->profile_photo . '" class="networksearchimage" /></a>
<a href="/' . $network_page . '/' . strtolower($value->f_name) . '-' . sanitize_title($value->l_name) . '/"><img src="' . $value->logo . '" class="networksearchlogo" /></a>
<h3><a href="/' . $network_page . '/' . strtolower($value->f_name) . '-' . sanitize_title($value->l_name) . '/">' . $value->f_name . ' ' . $value->l_name . ', ' . stripslashes($value->company_name) . '</a></h3>
<hr class="floatfixer" />
</div>';
}
}