Answered
DW MySQL query help
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.
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.