close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Data Assist Search showing results not in the recordset

Thread began 12/15/2010 4:24 pm by lightwalkercreations361768 | Last modified 12/17/2010 2:18 pm by Jason Byrnes | 2196 views | 6 replies |

lightwalkercreations361768Beta Tester

Data Assist Search showing results not in the recordset

Dear Webassist,

I am having a strange thing happening were if I search for a particular word I get a result that is not in the recordset. If I do a blank search to show all the results it is correct and only shows me the correct records from the recordset. I can not work out why this is happening.

the recordset query is:

SELECT RecipeID, Title, Serves, Intro, WhatYouNeed, HereHow, CountAs, CatagoryID
FROM Recipies
WHERE FoodPlan = 1

I have attached the web page as well. I would be grateful for some help as it is really important that the results are accurate and are not returning results that are not from the recordset.

Many thanks as always

Attached Files
results.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

can you please clarify what mean by "Results not in the recordset", I'm not quite sure I understand what you mean by this.

it would help to have a link where i could see the issue.


also, try adding the following code after the body tag to track the SQL being generated for the query:

php:
<?php echo("query: ".$query_limit_RecipiesRs)."<br />"?>
Sign in to reply to this post

lightwalkercreations361768Beta Tester

Dear Jason,

Thank you so much for your reply, that was really helpful. I see what is happening. the query generated is this:

SELECT RecipeID, Title, Serves, Intro, WhatYouNeed, HereHow, CountAs, CatagoryID FROM Recipies WHERE FoodPlan = 1 AND ((Title LIKE '%milk%')) OR ((WhatYouNeed LIKE '%milk%')) LIMIT 0, 10

what is happening is because of the OR it is not honoring the WHERE FoodPlan = 1 statement which means that it is returning results that are not FoodPlan = 1. I do need the OR as I want the search to look for the keyword in the "Title" as well as "WhatYouNeed" columns. But if I can change it to this:

SELECT RecipeID, Title, Serves, Intro, WhatYouNeed, HereHow, CountAs, CatagoryID FROM Recipies WHERE ((Title LIKE '%milk%')) OR ((WhatYouNeed LIKE '%milk%')) AND FoodPlan = 1 LIMIT 0, 10

were the AND FoodPlan =1 is at the end then the results will be correct. How can I do this?

I am sorry I am not able to upload this for you to see as everything is still being tested locally.

Many thanks again for your help

Sign in to reply to this post

lightwalkercreations361768Beta Tester

Dear Jason,

I have worked out the correct change I need to make to the SQL query but I am not sure how to add it to the Data Assist Search.

The current query is:

SELECT RecipeID, Title, Serves, Intro, WhatYouNeed, HereHow, CountAs, CatagoryID FROM Recipies WHERE FoodPlan = 1 AND ((Title LIKE '%milk%')) OR ((WhatYouNeed LIKE '%milk%')) LIMIT 0, 10

I need to change it to:

SELECT RecipeID, Title, Serves, Intro, WhatYouNeed, HereHow, CountAs, CatagoryID FROM Recipies WHERE HcgFoodPlan = 1 AND (((Title LIKE '%milk%')) OR ((WhatYouNeed LIKE '%milk%'))) LIMIT 0, 10

I just needed to add the additonal brackets around the query i.e (((Title LIKE '%milk%')) OR ((WhatYouNeed LIKE '%milk%'))). But I am not sure how to add this into the Data assist search assistant.

Many thanks as always for your help

Sign in to reply to this post

Jason ByrnesWebAssist

data assist does not offer the ability to create query groupings.


you could force the FoodPlan = 1 portion of the query to the end by adding it as a criteria in the data assist search.


another option if you are using MySQL 5 is to create a view in the database as:
SELECT RecipeID, Title, Serves, Intro, WhatYouNeed, HereHow, CountAs, CatagoryID FROM Recipies WHERE FoodPlan = 1



and set the recordset to use the view instead of the Recipies table.


see the following form more details on views:
views.html

Sign in to reply to this post

lightwalkercreations361768Beta Tester

Dear Jason,

Thank you so much for your help. I re worked my sql a bit so that it works well with data assist search. Thank you so much for the inspiration, working beautifully now.

Sign in to reply to this post

Jason ByrnesWebAssist

ok, glad to hear it is working.

Sign in to reply to this post

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...