Make sure to reset $ors when starting new loops.  Remove some extra parenthesis that get added to queries.  Fix broken database call.  Fix lists of page names being lowercased.  Fix not being able to set multiple of the same parameter.