@Nevermind:
Thanks for the response, I don't know why it's structured the way it is but that's how the people that wrote the original script put it.
I managed to figure it out with some help from my good friend Nascent:
as you can see, it wasn't one line, but two that needed to be commented out. Now it's working.
The ORDER BY line was having issues as it's variable was calling a value from the content_frontpage table and by commenting out that line it screwed everything up...
I'm going to try and modify it so that the ORDER BY thing works again. I'll post the finished code here.