[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums.
Line 607 is a "{", so that can't be the problem. On line 602 you make a query, and the $db variable doesn't exist, which is why you're getting the error. If this really is a CodeIgniter app, you shouldn't need to import globals at all.