0
I want to view the multiple records from database.by selected options by html.how can i execute multiple select queries
Please help me
9 Respuestas
+ 3
How does the HTML select menu affect your SQL query? can you elaborate more on this idea, because I'm not understanding your question really well. I encourage you to edit your post and add detailed explanation about your intention in the "Description" section, just to add clarity, and to narrow down the scope probably you could add "HTML" in your "Relevant Tags" list.
* I will remove this note as you updated your post. Thanks for understanding.
+ 2
I have better idea, save a copy of your code in your profile then attach the code URL in your original post (in "Description" section). That way more people can see it, not just me, meaning more help ...
+ 2
That's interesting, but I don't know how your database table relationship design, or fields definition, so it's a bit difficult for me to suggest anything. Well, in general your query might work, but remember, if the filtered field type is string (varchar, nvarchar etc.) you need to wrap the <r_o> or <i_a> argument in single quotes. But it's not necessary if the filtered field type was numerical. So, if the filtered field type is string you can try:
"Select * From table Where fieldname = '" + i_a + "';"
I am not experienced with JSP projects, but I understand SQL a little bit. You can test if the query succeeded and tell me how it goes : )
+ 2
Can you post here your table structure? I need to know what type of data "fieldname" was using. Also it might help to show if you get error message from that query. BTW what DBMS engine are you using?
(Edit)
You can also use both the filter arguments in a single query by combining the conditions with a boolean operator (AND or OR depending on requirements), such as this:
"SELECT * FROM table WHERE style_field = '" + i_a + "' AND facility_field = '" + r_o + "';"
This way the query will filter only those records that matched both filter criteria.
P.S. Try to print out the value of i_a and r_o to see if they contain a valid value for query filter. I see you didn't specify the "value" attribute for the <option> tags in the <select> menu, IIRC without the "value" attribute set the <option> text will be sent in request, I'm not sure if this was what you intended though.
+ 1
I'm working for real estate project....I wanna display selective multiple records by,
In jsp file:
**********
<td>select your Style<select name="i_a">
<option>Individual</option>
<option>Apartment</option>
</select>
</td>
</tr>
<tr>
<td>select your Facility:<select namqe="r_o">
<option>Duplex</option>
<option>Semi-Duplex</option>
</select>
**************In servlet file for view database by jdbc**********
String r_o = request.getParameter("r_o");
String i_a = request.getParameter("i_a");
The above statements get the selected options from jsp file and view the records from the database.
For that which query is used....????I think we want to execute multiple select queries like"select * from table where fieldname='"+r_o+"';
select * from table where fieldname='"+i_a+"';
Is this correct or not how it's work it's doesn't work for me.... please help
+ 1
I'm also used single quotes...but it's not work
0
Give your whats app num I will send my code
0
Tq...😊
0
Ok tq....