根本的な解決ではないかもしれませんが、「Cannot use object of type stdClass as array」エラーが出る場合は、配列の扱い方を以下のように変更する事で解決しました。 $row["catID"] ↓ $row->catID