Can someone help , with a php code to run and Optimize my Database .. Print Out error if Could not optimize some tabels , and print ok if all were done Ok .

I googled the web and found some but None Give u real result which tabels was optimized ok and which Could not be optimized.