98 Mazda Millenia emmisions problems

I have a 98 Mazda Millenia with the 2.5l engine. In our county in Texas they do emmisions testing. At first the 02sensor for bank1 sensor1 code came on. i replaced this sensor and then bank2 sensor1 and the spark knock sensor came on. (they were all circuit malfunctions) so after replacing the 02sensor for bank2 sensor1 myself and taking it to a shop for the knock sensor(I’m not that mechanically inclined) the 02sensor for bank1 sensor1 has come back on! this car is only worth 2000 dollars and i bought it for a thousand and have spent 600 already what could be the problem? is this a computer/ electrical issue?