Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%
- //follow2an-bricked
- //balikin value UID dari session
- ResultSet rs3 = st.executeQuery("SELECT * FROM msuser WHERE username = '"+username2+"'"); //username2 = follower
- rs3.next();
- String uidsession = rs3.getString("UID");
- //validasi tombol
- String jspFollow = "";
- String textFollow = "";
- //balikin tabel following
- ResultSet rs4 = st.executeQuery("SELECT COUNT(*) FROM following where followID ='" + username2 +"' AND followedID='" + userid + "'" );
- int numOfSelection = Integer.parseInt(rs4.next());
- if(!uidsession.equals(userid))
- {
- //<- bandingin ID profile = id session apa engga. kalo sama ga muncul tombol follownya
- if(numOfSelection == 0)
- //<- ngecek kalo di DB si username2 pernah ngefollow userid ato nggak
- {
- jspFollow = "doFollow.jsp?UID=" + userid;
- textFollow = "Follow";
- }
- else
- //<-- kalo di DB ada data klo si username2 pernah ngefollow userid
- {
- jspFollow = "doUnFollow.jsp?UID=" + userid;
- textFollow = "Unfollow";
- }
- out.write("<a href=\"" + jspFollow + "\"class=\"btn btn-lg btn-primary btn-block\" type=\"submit\">" + textFollow + "</a>");
- break;
- }
- }
- %>
Advertisement
Add Comment
Please, Sign In to add comment