It's damn simple.
Never go to a casino with 100% of your bankroll, only take what you can afford to lose DURING THAT SESSION.
Never play above a fixed bet so to have something left to play more, and read it carefully, I said "to play more", not "recover it back". If you will go with a mentality to recover your losses, you'll definitely either deposit more or just play till the last cent of your bankroll is left on your account to try and recover, and then mess up everything by losing it all because you lose your control and go for unnecessary big bets.
Gamblers that uses the martingale strategy to gamble do fall victim against this piece of advise, as they intend to increasing their wagering amount upon each bet that's how they gradually clear their bankroll with each bet loss while trying to recover all the losses through just one win in all.
Because it's a bankroll doesn't mean you'll have to squander it all in a day. Part of applying financial management in gambling is also in when a gambler is quick to realize when he's making too many loss for the day that he has got to stop and try again another day, because that day may not just be his lucky day as a continuous loss chasing can make you gamble beyond the amount you initially kept as your bankroll. Learning to know when to quit for the day isn't a show of weakness.