I am trying to store comments from a facebook post. There are 25 comments and I can get them all in a Json array and print to console with a for loop in Java. But when I try to store them into a MySql database, something occurs with 14th element of array. Program just ends without any error or exception. It just stores 13 elements to database and prints them to console. If it is not connected to database it prints all 25 elements to console. I control it with an if clause, changing the comment content like this:
String content;
for (int j = 0; j < array.size(); j++){
if (j==13)
{
content = "changed content";
}
else
{
content = ((JSONObject)array.get(j)).get("message").toString();
}
And I could store all the elements into my db. but of course 14th elements content was stored as "changed content."
I store them with this code:
String addComments = "INSERT INTO comments VALUES("+commentID+",'"+commentFrom+"','"
+content+"',"+likeCount+",'"+createdDate+"',"+postID+")";
stmt.executeUpdate(addComments);
I really have no idea why this problem occurs. I'm waiting for your help.