Solved

query statement-urgent

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 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

16 Experts available now in Live!

Get 1:1 Help Now