Can you remove the backticks (they're not needed and if we ever switch to a different db they'd cause an issue), and escape the $num, since it's passed in from externally I'm very wary to just trust it.