Resultset Problem

[nobr]I want to show some records alphabetically. these records have different categoryies. My problem is this that my code shows the same records for whole categories. Please guide me. thanks in advance

String alpha=req.getParameter("alpha");

String category=req.getParameter("category");

out.println("<ul><br><table border=0 width=410 align=center>");

String query=" select g_id,term from glossary where term like '"+alpha+"%' or term like lower('"+alpha+"%') or term like upper('"+alpha+"%') and category="+category+" order by term asc";

rs=stm.executeQuery(query);

while(rs.next()){

g_id=rs.getInt(1);

term=rs.getString(2);

out.println("<tr><td width=2><li></td>"+

"<td><a href=../servlet/displayGL?g_id="+g_id+">"+term+"</a></li></td></tr>");

}

out.println("</table>");

if(g_id<1 || term.equals("")){

out.println("<font color=olive size=3><b>No Data Found</b></font>");

}

[/nobr]

[1650 byte] By [farakha] at [2007-11-27 1:09:59]
# 1
I don't understand the requirement fully, but my guess is that you're just forgotten to group the OR's before the AND.
BalusCa at 2007-7-11 23:45:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
> I don't understand the requirement fully, but my> guess is that you're just forgotten to group the OR's> before the AND.thanks a lot BalusC. You are really geniusthanks again
farakha at 2007-7-11 23:45:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...