try{ Class.forName(driver).newInstance(); con = DriverManager.getConnection(url, "root", "root"); // String sql = "Select uname from user_reg where uname='Shreya'"; PreparedStatement ps=con.prepareStatement("Select * from user_reg_ml where uname='"+ name +"' OR email='"+ email +"'"); out.print("<table>"); out.print("<center><h1>Result:</h1></center>"); rs=ps.executeQuery(); /* Printing column names */ ResultSetMetaData rsmd=rs.getMetaData(); out.print("<tr>"); out.print(" <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>"); out.print(" <script src=\"js/index.js\"></script>"); while(rs.next()) { String friendname = rs.getString(2); out.print("<td>"+rs.getString(2)); // out.print("<button type=\"button\" onclick=friendnamebtn() id=\"btn_friends\">"); // out.print("<button type=\"button\" onclick='javascript:return friendnamebtn(this)' id=\"btn_friends\">"); out.print("<button type=\"button\" onclick='friendnamebtn(\""+ friendname +"\")' id=\"btn_friends\">"); out.print("Add" + friendname); out.print("</button>"); out.print("</td></tr>"); // out.print(rs.getString(2)); } out.print("</table>"); } catch (Exception e2) { out.print(e2); } finally{out.close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)