optimize table in stored produce using phpMyAdmin causes out of sync error
For INNODB I was able to do the same thing and it didn't cause an error in php.

Here is what I did:

 ALTER TABLE phppos_items FORCE;