Web Design and Development Forums

Search suggestions

This is a discussion on "Search suggestions" within the JavaScript Forum section. This forum, and the thread "Search suggestions are both part of the Program Your Website category.

Old Apr 26th, 2008, 13:56   #1 (permalink)
Lead Administrator
 
saltedm8's Avatar
 
Join Date: Nov 2005
Location: Always About
Age: 27
Posts: 1,063
Blog Entries: 1
Send a message via MSN to saltedm8
Search suggestions

i wanted to make a search engine for my site ( and before you go on about google, i dont want it )

i have something very specific in mind, i want the search to include Search Suggestions alot like ask.com

so when they start typing, possible results come up,

let me show you what i have

my table is as follows

Code: Select all
CREATE TABLE `recipes` (
  `Id` mediumint(13) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL default '',
  `yield` varchar(255) NOT NULL default '',
  `instructions` text NOT NULL,
  PRIMARY KEY  (`Id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=315743 ;
and i am going to make the results display within my sites template, linking to anther file that will pull the choosen result and display the recipe

so it is really just a search engine for my own site i suppose with Search suggestions

these results are coming from my database, does anyone know how this can be done ?

cheers
__________________
recipebite.co.uk - its a working progress...
saltedm8 is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 26th, 2008, 14:40   #2 (permalink)
 
Join Date: Jun 2007
Location: uk
Posts: 459
Re: Search suggestions

dont know about the search suggestions.

the actual search engine itself I might be able to help with.

I built one for my wifes site if you want to check it out.
dab42pat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 26th, 2008, 14:47   #3 (permalink)
Lead Administrator
 
saltedm8's Avatar
 
Join Date: Nov 2005
Location: Always About
Age: 27
Posts: 1,063
Blog Entries: 1
Send a message via MSN to saltedm8
Re: Search suggestions

its nice, if it grabs the information from the database its perfect, thank you

i think the search suggestions will more than likely be a little harder

cheers
__________________
recipebite.co.uk - its a working progress...
saltedm8 is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 26th, 2008, 14:49   #4 (permalink)
 
Join Date: Jun 2007
Location: uk
Posts: 459
Re: Search suggestions

Yes it grabs all the info from my Mysql database. I think the image is linked at the moment but anything grabbed from the database can be linked.
dab42pat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 26th, 2008, 14:58   #5 (permalink)
Lead Administrator
 
saltedm8's Avatar
 
Join Date: Nov 2005
Location: Always About
Age: 27
Posts: 1,063
Blog Entries: 1
Send a message via MSN to saltedm8
Re: Search suggestions

although the image is a very cool idea, unfortunetly at the moment, my database has no images, would be cool for the future though,

( i cant add images to them all as the database has 317,682 recipes )

please if you are willing, post either the code or the zip here,

cheers
__________________
recipebite.co.uk - its a working progress...
saltedm8 is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 26th, 2008, 15:00   #6 (permalink)
 
Join Date: Jun 2007
Location: uk
Posts: 459
Re: Search suggestions

Give me 10mins while i remove all my connection info.
dab42pat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 26th, 2008, 15:11   #7 (permalink)
 
Join Date: Jun 2007
Location: uk
Posts: 459
Re: Search suggestions

heres the code.

PHP: Select all

<?php require_once('Connections/yourconnection.php');

mysql_select_db($database_yours$yours); ?>
<?php
$currentPage 
$_SERVER["PHP_SELF"];

$maxRows_Recordset1 5;
$pageNum_Recordset1 0;
if (isset(
$_GET['pageNum_Recordset1'])) {
  
$pageNum_Recordset1 $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 $pageNum_Recordset1 $maxRows_Recordset1;

$colname_Recordset1 "-1";
if (isset(
$_GET['textfield'])) {
  
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['textfield'] : addslashes($_GET['textfield']);
}
mysql_select_db($database_yours$yours);
$query_Recordset1 sprintf("SELECT item_title, item_price, item_desc, item_image, hyper_link, `sql search` FROM store_items WHERE `sql search` LIKE '%%%s%%'"$colname_Recordset1);
$query_limit_Recordset1 sprintf("%s LIMIT %d, %d"$query_Recordset1$startRow_Recordset1$maxRows_Recordset1);
$Recordset1 mysql_query($query_limit_Recordset1$sensuallad) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);

if (isset(
$_GET['totalRows_Recordset1'])) {
  
$totalRows_Recordset1 $_GET['totalRows_Recordset1'];
} else {
  
$all_Recordset1 mysql_query($query_Recordset1);
  
$totalRows_Recordset1 mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$queryString_Recordset1 "";
if (!empty(
$_SERVER['QUERY_STRING'])) {
  
$params explode("&"$_SERVER['QUERY_STRING']);
  
$newParams = array();
  foreach (
$params as $param) {
    if (
stristr($param"pageNum_Recordset1") == false && 
        
stristr($param"totalRows_Recordset1") == false) {
      
array_push($newParams$param);
    }
  }
  if (
count($newParams) != 0) {
    
$queryString_Recordset1 "&" htmlentities(implode("&"$newParams));
  }
}
$queryString_Recordset1 sprintf("&totalRows_Recordset1=%d%s"$totalRows_Recordset1$queryString_Recordset1);
?>
Put this at the top of your results.php page. Just alter query recordset1 to your table fields.

Then the below code where you want the results to show.

PHP: Select all

<?php if ($totalRows_Recordset1 0) { // Show if recordset not empty ?>
      
<?php do { ?>
  
    
    <table width="100%" border="1">
    <?php if ($totalRows_Recordset1 0) { // Show if recordset not empty ?>
  <tr>
    <td><a href="<?php echo $row_Recordset1['hyper_link']; ?>"><img src="<?php echo $row_Recordset1['item_image']; ?>" alt="" name="sensual" style="width:100px; height:100px;" border="0"></a></td>
    
    <td width="20%" style="padding-left:4px;"><a href="<?php echo $row_Recordset1['hyper_link']; ?>"><span class="style5"><?php echo $row_Recordset1['item_title']; ?></span></a></td>
    
    <td  style="padding-left:4px; padding-right:4px;"><a href="<?php echo $row_Recordset1['hyper_link']; ?>"><span class="style2"><?php echo $row_Recordset1['item_desc']; ?></span></a></td>
    
    <td  style="padding-left:4px; padding-right:4px;"><a href="<?php echo $row_Recordset1['hyper_link']; ?>"><span class="style2">£<?php echo $row_Recordset1['item_price']; ?></span></a></td>
  </tr> 
  
</table>

      
      <?php // Show if recordset not empty ?>
     
      
    
      <?php if ($totalRows_Recordset1 0) { // Show if recordset not empty ?>
        
        <?php // Show if recordset not empty ?>
        
    
      <?php if ($totalRows_Recordset1 0) { // Show if recordset not empty ?>
        
  
  <br />
        <?php // Show if recordset not empty ?>
   
     
  
  <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?>
     
      
      
        <?php if ($totalRows_Recordset1 0) { // Show if recordset not empty ?>
          <a href="<?php printf("%s?pageNum_Recordset1=%d%s"$currentPagemax(0$pageNum_Recordset1 1), $queryString_Recordset1); ?>"><br>
          Back </a> <a href="<?php printf("%s?pageNum_Recordset1=%d%s"$currentPagemin($totalPages_Recordset1$pageNum_Recordset1 1), $queryString_Recordset1); ?>">Next</a>
          <?php // Show if recordset not empty ?></div>
      <?php // Show if recordset not empty ?>
      <p align="center" ><?php if ($totalRows_Recordset1 0) { // Show if recordset not empty ?>
  &nbsp; <span class="style43Copy">Page:</span>
  <?php
for ($i=0$i <= $totalPages_Recordset1$i++) {
  
$TFM_PagesEndCount $i 1;
  if(
$i != $pageNum_Recordset1) {
    
printf('<a href="'."%s?pageNum_Recordset1=%d%s"$currentPage$i$queryString_Recordset1.'">'.$TFM_PagesEndCount."</a>");
  }else{
    echo(
"<strong>$TFM_PagesEndCount</strong>");
  }
  if(
$i != $totalPages_Recordset1) echo("  ");
}
 
?>
  <?php // Show if recordset not empty ?>
Sorry the display is coded in tables im sure it wouldnt be to difficult to change to css, I just havent bothered
dab42pat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 26th, 2008, 15:11   #8 (permalink)
Lead Administrator
 
saltedm8's Avatar
 
Join Date: Nov 2005
Location: Always About
Age: 27
Posts: 1,063
Blog Entries: 1
Send a message via MSN to saltedm8
Re: Search suggestions

very cool thank you,

just need a search suggestions script now if anyone knows one
__________________
recipebite.co.uk - its a working progress...
saltedm8 is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 26th, 2008, 15:26   #9 (permalink)
Lead Administrator
 
saltedm8's Avatar
 
Join Date: Nov 2005
Location: Always About
Age: 27
Posts: 1,063
Blog Entries: 1
Send a message via MSN to saltedm8
Re: Search suggestions

oh, i have found one, but it is ajax, can anyone give me a hand setting it up please ?

( moved to javascript forum, i may have better luck )

thanks


http://www.petefreitag.com/item/605.cfm

http://script.aculo.us/downloads
__________________
recipebite.co.uk - its a working progress...

Last edited by saltedm8; Apr 26th, 2008 at 15:34.
saltedm8 is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Your suggestions please Tyrtl New to Web Design 4 Sep 10th, 2007 15:37
Search Analyst/Account Executive/SEO/PPC/CPC/Search Engine Optimisation/Pay per Click/London Web JobBot Job Opportunities 0 Nov 22nd, 2006 10:20
SEO/PPC/Search Engine Optimisation/Pay Per Click/Campaigns/Online/Marketing/Agency/Analyst/Search/Manager/Executive/Manchester Web JobBot Job Opportunities 0 Nov 17th, 2006 11:11
PHP Search systems that will search mysql bohboh PHP Forum 3 May 10th, 2006 09:52
I would like to add a search facility on my website - any suggestions? constantinesavva HTML Forum 3 Feb 25th, 2006 23:34



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 23:33.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59