Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

DW MySQL query help

Guest
Jun 01, 2006 Jun 01, 2006
I'm fairly new to DW and MySQL. I'm trying to develop what I thought was a simple search and results app., but am apparently having a program logic issue

I have a form with 2 radio buttons, code below:

<form name="card_search" id="card_search" method="post" action="card_search_results.asp">
<p>
<label>
<input <%If (CStr((rsCardCatBaseball.Fields.Item("catID").Value)) = CStr("1")) Then Response.Write("CHECKED") : Response.Write("")%> type="radio" name="RadioGroupCardCat" value="1" />
Baseball</label>
<br />
<label>
<input <%If (CStr((rsCardCatBaseball.Fields.Item("catID").Value)) = CStr("2")) Then Response.Write("CHECKED") : Response.Write("")%> type="radio" name="RadioGroupCardCat" value="2" />
Football</label>
<br />
<input name="submit_card_cat" type="submit" id="submit_card_cat" value="Submit" />
</p>
</form>

When testing using the GET URL param. I see that the var RadioGroupCardCat=1 (baseball) or RadioGroupCardCat=2 (football) are getting passed to the card_search_results.asp page. However, I can't seem to figure out how to capture the RadioGroupCardCat values (1 or 2) in my SQL queries. I currently have 2 recordset queries (rsCardCatBaseball and rsCardCatFootball) below.

rsCardCatBaseball:

SELECT tblcard.cardyear, tblcardvend.vendname, tblcard.cardnum
FROM tblcard, tblcardcat, tblcardvend
WHERE RadioGroupCardCat=1 AND tblcardvend.vendid=tblcard.vendid AND tblcardcat.catid=tblcard.catid

rsCardCatFootball:

SELECT tblcard.cardyear, tblcardvend.vendname, tblcard.cardnum
FROM tblcard, tblcardcat, tblcardvend
WHERE RadioGroupCardCat=2 AND tblcardvend.vendid=tblcard.vendid AND tblcardcat.catid=tblcard.catid

'catid' is the MySQL table field with either a value of 1 (baseball) or 2 (football). I'm using ASP/VBScript, so below is how the variable is declared in the RecordSet variables area of DW.

FOR rsCardCatBaseball:

NAME
RadioGroupCardCat

DEFAULT VALUE
1

RUNTIME VALUE
Request("catid")

For rsCardCatFootball:

NAME
RadioGroupCardCat

DEFAULT VALUE
2

RUNTIME VALUE
Request("catid")

The problem is that I get the same results for both queries. The results for the rsCardCatFootball query are identicle to the rsCardCatBaseball query. Aren't I supposed to have 2 seperate recordsets in the results page so that one gets passed one value and the other RS gets the other value? Any assistance much appreciated. Thanks.
TOPICS
Server side applications
371
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Jun 07, 2006 Jun 07, 2006
Thanks for the reply. I finally found the answer to my question at:

http://www.adobe.com/support/ultradev/building/multiple_param_search/multiple_param_search05.html

The varible declaration in my SQL statement and DW were incorrect. I highly recommend the above tutorial for anyone new to DW and MySQL. The link above specifically explains how to create a variable to be used in a DW/MySQl app. Thanks!
Translate
Guest
Jun 02, 2006 Jun 02, 2006
After reading my original post, I see that it is was not worded very well. Basically the problem I am having is understanding how to capture values that are sent from a form to results page using Dreamweaver MX and MySQL. Specifically, creating a group of two radio buttons where two values are sent to a results.asp page that contains a Recordset Query (using MySQL syntax) that will display the query results based on the values being sent from the form with the radio buttons. The radio button values being sent are either a '1' or a '2', depending on which radio button is selected and submitted. My current understanding is that I need to have two Recordset queries, one to capture each value being submitted. Thus I have a Recordset with a MySQL select statement designed to capture the value '1' and display the results, and a Recordset with a MySQL statement to capture the value '2' and display the results. At present when I Submit the radio button values, either a '1' or '2', I always get the display results for the Recordset Query designed to capture the value '1'. So, I believe that either I have NOT designed the program logic correctly in Dreamweaver to capture two different values using two Recordsets, or my MySQL statement is flawed. I guess my primary questions are:

1) Should I be using two Recordsets or one Recordset in this case?

2) If I should be using one Recordset, can anyone point me to a sample MySQL select statement that handles two vales being submitted from a form?

I have googled extensively looking for examples of how to do this, and used a book I have that has some examples, but NOT MySQL examples. Any comments/suggestions appreciated. Thank you.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2006 Jun 03, 2006
A radio group is only supposed to pass one value from the form depending
upon which option has been clicked, therefore on the results page you should
only need one recordset providing that everything is going against the same
table. Providing that a value of 1 or 2 relate to the same field then you
will be able to use the recordset dialogue box to build the SQL.

However if different tables or fields are involved then you will need to
handwrite the SQL statement

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"obcbeatle" <webforumsuser@macromedia.com> wrote in message
news:e5pbjd$hlp$1@forums.macromedia.com...
> After reading my original post, I see that it is was not worded very well.
> Basically the problem I am having is understanding how to capture values
> that
> are sent from a form to results page using Dreamweaver MX and MySQL.
> Specifically, creating a group of two radio buttons where two values are
> sent
> to a results.asp page that contains a Recordset Query (using MySQL syntax)
> that
> will display the query results based on the values being sent from the
> form
> with the radio buttons. The radio button values being sent are either a
> '1' or
> a '2', depending on which radio button is selected and submitted. My
> current
> understanding is that I need to have two Recordset queries, one to capture
> each
> value being submitted. Thus I have a Recordset with a MySQL select
> statement
> designed to capture the value '1' and display the results, and a Recordset
> with
> a MySQL statement to capture the value '2' and display the results. At
> present
> when I Submit the radio button values, either a '1' or '2', I always get
> the
> display results for the Recordset Query designed to capture the value '1'.
> So,
> I believe that either I have NOT designed the program logic correctly in
> Dreamweaver to capture two different values using two Recordsets, or my
> MySQL
> statement is flawed. I guess my primary questions are:
>
> 1) Should I be using two Recordsets or one Recordset in this case?
>
> 2) If I should be using one Recordset, can anyone point me to a sample
> MySQL
> select statement that handles two vales being submitted from a form?
>
> I have googled extensively looking for examples of how to do this, and
> used a
> book I have that has some examples, but NOT MySQL examples. Any
> comments/suggestions appreciated. Thank you.
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 07, 2006 Jun 07, 2006
LATEST
Thanks for the reply. I finally found the answer to my question at:

http://www.adobe.com/support/ultradev/building/multiple_param_search/multiple_param_search05.html

The varible declaration in my SQL statement and DW were incorrect. I highly recommend the above tutorial for anyone new to DW and MySQL. The link above specifically explains how to create a variable to be used in a DW/MySQl app. Thanks!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines