Solved

query statement-urgent

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Fine Tune your automatic Updates for Ubuntu / Debian
Scenario: Your operations manager has discovered an anomaly in your security system. The business will start to suffer within 15 minutes if it is a major IT incident. What should she do? We have 6 recommendations for managing major incidents (https:…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

948 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now