Wherever the code issue is that triggered the error. And to find that out, it often works best to start looking where the error occurred. Which is db.php, as you can clearly see.
The Stack Trace just shows how the code was called, which is useful for troubleshooting, but doesn’t indicate that the calling code is wrong.
By fixing the syntax error in your code. Probably you have an if statement or something on line 32 with an opening curly bracket but missed the closing curly bracket, and if so you need to add it.