Forum Moderators: coopster
<?php if(isset($_POST['submit'])){ ?>
<br />
<br />
<table id="results_box" cellpadding="0" cellspacing="0">
<?php $bg = 'alt2'; ?>
<?php echo '<pre>',print_r($results['rows']),'</pre>'; ?>
<?php foreach( $results['rows'] as $row){ ?>
<?php $podcasts = getRelatedPodcasts('item',$row['record_id']); ?>
<?php $images = getRelatedImages('item',$row['record_id']); ?>
<?php $main_image = getAndShowMainImage('item',$row['record_id'],'mini'); ?>
<?php $color_class = str_replace(' ','-',$row['category']); ?>
<?php $people = getRelatedPeople('item',$row['record_id']); ?>
<?php $bg = ($bg == 'alt2' ? 'alt1' : 'alt2'); ?>
<tr class="<?php echo $bg; ?>" onClick="Link('index.php?page=entry&permalink=<?=$row['record_id']; ?>')">
<td class="leftrows <?=$color_class?>">
<?=$main_image?>
</td>
<td class="next-to-leftrows " width="25%">
<div class="text-headroom">
<font class="title-medium"><?php echo highlight($row['name_title'],$_POST['search_param']); ?></font><br />
<span class="small"><?=highlight($row['city'],$_POST['search_param'])?>, <?=$row['state']?> • <?=highlight($row['category'],$_POST['search_param'])?></span>
</div>
</td>
<td class="rows" width="25%">
<div class="text-headroom">
<ul class="small">
<?php
foreach($people['record_ids'] as $key => $person){ ?>
<li><?=highlight(getPersonName($person,'FL'),$_POST['search_param'])?></li>
<?php } ?>
</ul>
</div>
</td>
<td class="rows small" width="45%"><?php // echo constrainLongText($row['remarks'],150); ?></td>
<td class="rightrows small" align="right" width="25">
<?php if($podcasts['count'] > 0){ ?>
<img src="ui/images/headphones.png" />
<?php } ?>
</td>
</tr>
<?php }
} // end if submit for results ?>
</table>
<?php if(isset($_POST['submit'])){ ?>
<div class="fullwidth">
<div class="floatleft leftalign half">
<br />
Your search returned <?=$results['count']?> results<?php if($results['count'] >= 2 ? 's' : ''); ?>.
<br /><br />
</div>
<div class="floatright rightalign half">
<br />
<?php
echo prevNextRecordsGroup(currentPageURL(),stickyForm('start_at','0'),stickyForm('rows_to_show','25'),$results['count']);
?>
<br /><br />
</div>
<?php } // end if submit for paging ?>
</div><!-- /bluebox -->
function basicItemSearch($search_param = '',$start_at = 0,$rows_to_show = 25){
if($rows_to_show == 'all'){
$rows_to_show = '';
$limit = '';
}else{
$limit = ' LIMIT ' . $start_at . ', ' . $rows_to_show;
}
$q = "SELECT DISTINCT item.*
FROM item, item_people, people
WHERE item.record_id = item_people.item_id AND people.record_id = item_people.people_id
AND
(concat_ws(' ',people.name_first,people.name) LIKE '%$search_param%' OR
item.name_title LIKE '%$search_param%' OR
item.city = '$search_param' OR
item.category LIKE '%$search_param%' OR
item.on_lists LIKE '%$search_param%')
$limit";
//echo 'query: ',$q,'<hr/>';
$r = @mysql_query($q) OR die('unable to execute query <i>' . $q . '</i>: ' . mysql_error());
while($row = mysql_fetch_array($r, MYSQL_ASSOC)){
$row = clean_array($row);
$rows[] = $row;
}
$results = array('query' => $q,'count' => '55', 'rows' => $rows);
return $results;
}