migrated to mysqli php functions