fixed bug and use mysqli connection