modified mysql page logic.....to right