close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Need a hand getting started with Search page

Thread begun 7/25/2011 8:23 am by A Sound Design | Last modified 7/26/2011 10:22 am by Jason Byrnes | 3914 views | 13 replies |

A Sound Design

Need a hand getting started with Search page

I've been trying to follow the tutorial but am finding it hard to adapt to my own site.

I would like to create a search page to return results from a links directory database. What I want is so that visitors can enter a search term, eg. photographer, it will return only those records that are related to photography. I have tried using a Db field called Keywords and set the search wizard to target that but it just displays all records in the Db.

My code is:

php:
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: rsItems;
//Searchpage: search.php;
//Form: frmSearchForm;
$WADbSearch1_DefaultWhere "WHERE 0 <> 0";
if (!
session_id()) session_start();
if (isset(
$_POST["button2"])) {
  
$WADbSearch1 = new FilterDef;
  
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
  
//keyword array declarations
  
$KeyArr1 = array("Keywords");

  
//comparison list additions
  
$WADbSearch1->keywordComparison($KeyArr1,"".$row_rsItems['Keywords']  ."","OR","Includes","%20AND%20","%20OR%20","%22","%22",0);

  
//save the query in a session variable
  
if (== 1) {
    
$_SESSION["WADbSearch1_search_results"]=$WADbSearch1->whereClause;
  }
}
else     {
  
$WADbSearch1 = new FilterDef;
  
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
  
//get the filter definition from a session variable
  
if (== 1)     {
    if (isset(
$_SESSION["WADbSearch1_search_results"]) && $_SESSION["WADbSearch1_search_results"] != "")     {
      
$WADbSearch1->whereClause $_SESSION["WADbSearch1_search_results"];
    }
    else     {
      
$WADbSearch1->whereClause $WADbSearch1_DefaultWhere;
    }
  }
  else     {
    
$WADbSearch1->whereClause $WADbSearch1_DefaultWhere;
  }
}
$WADbSearch1->whereClause str_replace("\\''""''"$WADbSearch1->whereClause);
$WADbSearch1whereClause '';
?>
Sign in to reply to this post

Ray BorduinWebAssist

This looks wrong... I think this:

$WADbSearch1->keywordComparison($KeyArr1,"".$row_rsItems['Keywords'] .""

should be:

$WADbSearch1->keywordComparison($KeyArr1,"Keywords"

Sign in to reply to this post
Did this help? Tips are appreciated...

A Sound Design

Originally Said By: Ray Borduin
  This looks wrong... I think this:

$WADbSearch1->keywordComparison($KeyArr1,"".$row_rsItems['Keywords'] .""

should be:

$WADbSearch1->keywordComparison($KeyArr1,"Keywords"  



Didn't make any difference changing that.

Sign in to reply to this post

Ray BorduinWebAssist

Can you upload a copy of your search page and your results page? If I can look at both I'll be able to spot any issues.

Sign in to reply to this post
Did this help? Tips are appreciated...

A Sound Design

I fiddled around and tried changing stuff since I last posted.

Sign in to reply to this post

Ray BorduinWebAssist

Try changing:

$WADbSearch1->keywordComparison($KeyArr1,"Keywords",

to:

$WADbSearch1->keywordComparison($KeyArr1,"".$_POST['Search'] .""

Sign in to reply to this post
Did this help? Tips are appreciated...

A Sound Design

That gives an error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\xampp\htdocs\affiancedv2\search_results.php on line 24

I understand that you're trying to help but I don't understand why there needs to be a lot of fiddling. I bought Data Assist as it promised results without a load of coding. I cannot understand why it does not work by just running the DA Search Wizard. What I need is a simple search page, where a customer can type in a search phrase, eg. video production, and get a list of all records that are related to that. I only used a keywords field in the DB as I thought this might be a more targetted way of doing it. If there is a better way I'd be happy to know. Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

This is the correct way of doing it. The only problem was that you bound the search value to the recordset field instead of the form field. I made a mistake when I suggested the first correction which I apologize for. It is just a small tweak because you selected the wrong value when setting up the search.

If you attach a copy of the code or show me the line of code that is giving the error I can point out the problem and we can get it fixed.

If you want to delete the code an re-apply the search it would have worked properly if you bound the search value to the form field instead of the recordset field.

Sign in to reply to this post
Did this help? Tips are appreciated...

A Sound Design

Ok, I've attached the files.

Sign in to reply to this post

Jason ByrnesWebAssist

line 24:

php:
$WADbSearch1->keywordComparison($KeyArr1,"".$_POST['Search'] ."" "OR","Includes","%20AND%20","%20OR%20","%22","%22",0);


is missing a comma, it should be:

php:
$WADbSearch1->keywordComparison($KeyArr1,"".$_POST['Search'] ."", "OR","Includes","%20AND%20","%20OR%20","%22","%22",0);
Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...