It looks like you have added an old style recordset instead of a mySQLi recordset. Make sure you are using a mySQLi Connection and recordset and you shouldn't have this issue. Old style Recordsets don't work on php7 or later, that is probably why it works in one location and not the other.