insertId() wasn't working for mysqli. Updated version.