Forums

This topic is locked

Query change due to drop down selection

Posted 27 Mar 2007 19:10:57
1
has voted
27 Mar 2007 19:10:57 zafarana gisondi posted:
Hello everyone! I was just having some trouble with this.. hoping someone could advise me of what to do or where i'm going wrong.
Using dreamweaver/java/javascript to do this. I have a dynamic drop down and a dynamic table. The dynamic drop down is populated with certain values from the dynamic table. Upon click options in the dynamic drop down, my dynami table needs to b filtered for that specific value. I have tried numerous thigns but nothing seems to work. I can't take the bvalue from my drop down and some how put it in the query which I think is automatically in java (where the connection and prepared statement etc is)

<%
Driver DriverDetail = (Driver)Class.forName(MM_QDrmysql_DRIVER).newInstance();
Connection ConnDetail = DriverManager.getConnection(MM_QDrmysql_STRING,MM_QDrmysql_USERNAME,MM_QDrmysql_PASSWORD);
PreparedStatement StatementDetail = ConnDetail.prepareStatement("SELECT * FROM qdr.detail WHERE SL>0.6 ORDER BY Intr DESC";
ResultSet Detail = StatementDetail.executeQuery();
boolean Detail_isEmpty = !Detail.next();
boolean Detail_hasData = !Detail_isEmpty;
Object Detail_data;
int Detail_numRows = 0;
%>

the query is what i want to change.. where it says ">0.6" the 0.6 needs to be a variable from the drop down.

ANY IDEAS?

Replies

Replied 28 Mar 2007 18:30:34
28 Mar 2007 18:30:34 Javier Castro replied:
I'm not sure if this will work but it's worth a try.

When you are creating your query in Advanced view in DW:

WHERE SL>0.6 I think should be WHERE SL>"Param"

then you create below in your parameters section

Name: Param
Type: text or Numer (test it)
Request.query.String("value" "value" is the name of your select menu
Default value: 0

Good luck.
Replied 28 Mar 2007 19:34:51
28 Mar 2007 19:34:51 zafarana gisondi replied:
Hi thanks for yoru response! I think I've already tried that. The variable is stored in javascript but the driver stuff i posted was in java. it just doesn't seem to be able to 'resolve' the variable.. not sure.

Reply to this topic