flat tyre even after replacing the tube?
Start by replacing your tyre.  If you can see any part of the fibres at all, then it is long overdue replacing!  Buy a new tube too.

Then, inspect the rim and rimtape, if anything looks like it may chafe or cause an issue, then repair / replace it.  

Tubes go flat if left for a long time in any case. If you buy a decent tube, they will keep their pressure for longer. I only buy Schwalbes for my roadie and easily pay more than $10 a tube, but I ride competitively, and I know that they will keep their pressure for at least a month before needing topping up.