• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot retrieve all the name from MySQL

 
John Joe
Ranch Hand
Posts: 55
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to retrieve all the name and the number of row in MySQL to java. So far I only able to retrieve the total row number but I only get the last name. What's wrong here ?

StaffManagment.java





adminAPI



 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your loop, you are retrieving the value from each line and placing into a variable, but then you are replacing that value. So at the end of the loop, the variable only contains the last value from the table.
 
John Joe
Ranch Hand
Posts: 55
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keith Lynn wrote:In your loop, you are retrieving the value from each line and placing into a variable, but then you are replacing that value. So at the end of the loop, the variable only contains the last value from the table.


What should I do so it can retrieve all name ? Thanks
 
John Joe
Ranch Hand
Posts: 55
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I solved it.



Change this line in StaffManagement


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic