Knowing the limit how much to get a loan based on my own income and how much should I spend on gambling.
Based on your experience, I'd say that you make 2 mistakes here.
First is that you take a loan but you did not calculate it wisely and 2nd mistake is that you use all the loan for gambling.
Actually the main problem here is not about "gamble with loan money" but it is more about "addiction" which make you lose your own control.
Sorry to hear it, it is an expensive lesson for you and hopefully you can overcome it without making other mistakes.