Jump to content


Photo

Search using Dreamweaver GUI


  • Please log in to reply
6 replies to this topic

#1 uberfred

uberfred
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 18 April 2004 - 01:55 AM

My project is a recipe database. I just want to be able to search one field in one table for key words.

It would also be easier to do if I can work out how to do it using the Dreamweaver (MX 2004) GUI to do it.

SO far I have set a recordset with:
SELECT *
FROM tbl_recipes
WHERE tbl_recipes.recipe_detail LIKE svar

Then I've gone on to define the svar variable which is a search variable passed in the URL.

Variable name: svar
Default Value: 0
$_GET["txt_searchterms"]

When I run the search it returns an error saying Unknown column 'whateversearchtermused' in 'where clause'

How can I fix my record set? Is this just a syntax problem?

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 18 April 2004 - 03:49 AM

Based on what I understood from your post, it has all the makings of at least a syntax error. Is your field name really tbl_recipes.recipe_detail (or is it recipe_detail)?Post the actual php code you have that retrieves the search word(s), along with the actual database query you're using, and someone can offer a suggestion/solution.
Legend has it that reading the manual never killed anyone.
My site

#3 uberfred

uberfred
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 18 April 2004 - 11:50 AM

Thanks for the response. The recordset query is (all generated by DW):

<?php
$svar_rsrecipes = "0";
if (isset($_GET["txt_searchterms"])) {
$svar_rsrecipes = (get_magic_quotes_gpc()) ? $_GET["txt_searchterms"] : addslashes($_GET["txt_searchterms"]);
}
mysql_select_db($database_recipes, $recipes);
$query_rsrecipes = sprintf("SELECT * FROM tbl_recipes WHERE tbl_recipes.recipe_detail LIKE %s", $svar_rsrecipes);
$rsrecipes = mysql_query($query_rsrecipes, $recipes) or die(mysql_error());
$row_rsrecipes = mysql_fetch_assoc($rsrecipes);
$totalRows_rsrecipes = mysql_num_rows($rsrecipes);
?>

The rest is just echo statements with a loop to display the results.

Thanks again for any responses.

#4 homchz

homchz
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts
  • LocationLee, New Hampshire

Posted 18 April 2004 - 02:23 PM

Not and expert but every Record Set I make the Variable always equals 1

#5 uberfred

uberfred
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 18 April 2004 - 08:53 PM

Thanks for the suggestion but no good - same reply for default variable of 1.

#6 homchz

homchz
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts
  • LocationLee, New Hampshire

Posted 18 April 2004 - 09:03 PM

WHERE tbl_recipes.recipe_detail LIKE svar


I believe you are making you query to complex for DMX


SELECT *
FROM tbl_recipes
WHERE recipe_detail LIKE 'svar'

do you want it to be like or equal what "svar" equals

if you are going for exact I would do

SO far I have set a recordset with:
SELECT *
FROM tbl_recipes
WHERE recipe_detail = 'svar'


I think DMX like the '-----' around the variable too for whatever reason so you might try just adding those.








#7 uberfred

uberfred
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 19 April 2004 - 10:14 AM

I wondered whether it was too complex for DW. I can't see many tutorials on this specific topic.

As for = or LIKE I want to be able to try them both and compare results.

Thanks for your replies.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users