Solved

query statement-urgent

Posted on 2003-11-24
4
222 Views
Last Modified: 2010-04-01
i have a table that has checkboxex, my problem is when the user checks a chekcbox, the username of the table needs to be queried.
For example:

checkbox username address
/

if user checks the checkbox, the username of the table needs to be queried so it could be something like this:

select * from mytable where checked...

Thanks


0
Comment
Question by:Jasbir21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 70 total points
ID: 9811002
Say you have:

  <input type="checkbox" name="query" value="1"> User1 His house
  <input type="checkbox" name="query" value="2"> User2 Her house

Then you can do:

<%
    String sids = "" ;
    String select = "SELECT * FROM USERTABLE WHERE
    String[] ids = request.getParameters( "query" ) ;
    for( int i = 0 ; i < ( ids == null ? 0 : ids.length ) ; i++ )
    {
        if( i > 0 )
            sids += " OR " ;
        sids += "( ID = " + ids[ i ] + " ) " ;
    }
    if( sids.length() > 0 )
    {
         out.println( "EXECUTE QUERY " + select + sids ) ;
    }
%>
0
 

Author Comment

by:Jasbir21
ID: 9814551
hi,
   i got this error:

:\apache\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp2\menuuser_jsp.java:181: cannot resolve symbol
symbol  : method getParameters (java.lang.String)
location: interface javax.servlet.http.HttpServletRequest
    String[] ids = request.getParameters( "delete" ) ;
                          ^
after closing the string
String select = "SELECT * FROM USERTABLE WHERE ";

thanks
0
 
LVL 19

Assisted Solution

by:Kuldeepchaturvedi
Kuldeepchaturvedi earned 30 total points
ID: 9815711
try getParameterValues();
0
 

Author Comment

by:Jasbir21
ID: 9817541
thank you
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Spring Data jpa resouce mapping error "status":500,"error":"Internal Server Error", 3 375
squirrelPlay java challenge 40 160
grep code 4 217
jsp login check 12 67
Invest in your employees with these five simple steps to improve employee engagement and retention.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question