Solved

query statement-urgent

Posted on 2003-11-24
4
221 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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
Many businesses neglect disaster recovery and treat it as an after-thought. I can tell you first hand that data will be lost, hard drives die, servers will be hacked, and careless (or malicious) employees can ruin your data.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

830 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