Search Database and List Results

5 posts by 2 authors in: Forums > CMS Builder
Last Post: April 26, 2012   (RSS)

By Mohaukla - April 24, 2012

OK I have a search box on almost every page that I would like to search through the database and pull out a list of records that contain the search criteria.
So it would search all the titles, summary, keyword, and content areas and list out the entries that match the search.

<form class="search" id="search" method="post" action="search.php">
<input type="text" onFocus="if(this.value=='Looking for something...') this.value='';" onBlur="if(this.value=='') this.value='Looking for something...';" value="Looking for something..." size="30" class="inputbox" maxlength="60" name="title,summary,keywords,content,content_keyword" id="search_box">
</form>


Then on the results listing page
<div class="layout-cell content">
<div class="box post">
<?php foreach ($THESEARCHRESULTS as $record): ?>
<div class="componentheading"><a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></div>
<div class="box-body post-body">
<div class="post-inner article">

<article class="postcontent">
<!-- article-content -->
<?php if ($record['summary']): ?>
<?php echo $record['summary'] ?><br/>
<?php endif ?>
<?php ($record['content']): ?><!-- Would like to limit this output to a certain number of characters -->
<?php endforeach ?>
<div class="cleared"></div>

<!-- /article-content -->

</article>
<div class="cleared"></div>
</div>

<div class="cleared"></div>
</div>
</div>

<div class="cleared"></div>
</div>


Its ugly and does not work in its state now but that is what I'm shooting for.

Any help will be appreciated.

Michael
Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"

Re: [justritedesign] Search Database and List Results

By Jason - April 25, 2012

Hi,

When you say that it isn't working, are you getting an error message, or is it that no results are being returned? Can you attach search.php so we can take a closer look at what's happening?
---------------------------------------------------
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: [justritedesign] Search Database and List Results

By Jason - April 26, 2012

Hi Michael,

It seems like 1 of your two sections doesn't have a field called summary in it. Make sure that the fields you use in the form match fields in your target section(s).

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] Search Database and List Results

By Mohaukla - April 26, 2012

Thanks Jason,
I did have one field wrong.

The site is working now with the search boxes all filtering properly.

http://montedentistry.com/www2/search.php

If you use teeth as the keyword you will see what I have done with the multisearch.php page parts.

I was also able to figure the cloud tags and make them use the search page as well.

Thanks for your help ...

Michael
Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"