Post Code Search

5 posts by 2 authors in: Forums > CMS Builder
Last Post: December 6, 2010   (RSS)

By KCMedia - December 5, 2010

Hi

I have setup a multi section in CMS Builder with all the fields that are needed for the search but now i need some help as to how to get a search working and to display the results.

I have attached the main search page and also the results page i want to be able to have users search for a post code and then it will display any matching results for that post code.

thanks

Craig
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [Jason] Post Code Search

By KCMedia - December 6, 2010

hi Jason

I sort of got it working

If i search for a post code say 2234 it will show just one result but i know that there are more results than just that why is it only showing 1 result.

here is the link to the site page http://www.afft.com.au/newsite/postcode-search.php

and also the page codes for each page.

thanks

Craig
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Post Code Search

By Jason - December 6, 2010

Hi Craig,

You're query is probably returning more than 1 result, but you're only displaying one. You need to make two changes.
1) remove the "get first record" line:
// load records
list($post_code_searchRecords, $post_code_searchMetaData) = getRecords(array(
'tableName' => 'post_code_search',
));
$post_code_searchRecord = @$post_code_searchRecords[0]; // get first record


Next, you'll need to use a foreach loop to display all the records that were returned:

<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<?php foreach($$post_code_searchRecords as $post_code_searchRecord):?>
Pcode: <?php echo $post_code_searchRecord['Pcode'] ?><br/>
Locality: <?php echo $post_code_searchRecord['Locality'] ?><br/>
State: <?php echo $post_code_searchRecord['State'] ?><br/>
Comments: <?php echo $post_code_searchRecord['Comments'] ?><br/>
DeliveryOffice: <?php echo $post_code_searchRecord['DeliveryOffice'] ?><br/>
PresortIndicator: <?php echo $post_code_searchRecord['PresortIndicator'] ?><br/>
ParcelZone: <?php echo $post_code_searchRecord['ParcelZone'] ?><br/>
BSPnumber: <?php echo $post_code_searchRecord['BSPnumber'] ?><br/>
BSPname: <?php echo $post_code_searchRecord['BSPname'] ?><br/>
Category: <?php echo $post_code_searchRecord['Category'] ?><br/>
<hr/>
<?php endforeach ?>
<?php if (!$post_code_searchRecords): ?>
No record found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Post Code Search

By KCMedia - December 6, 2010

Hi Jason

thanks for that works great now.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz