Solved

query statement-urgent

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to access elements of included jsp  from parent jsp's save button 9 22
JSP Popup page 2 115
How to Post an If Statement in JSP 3 54
login jsp example 24 47
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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 …

776 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