Supplied argument is not a valid MySQL result resource at line 33
Why do you made this \\? I would say this is the problem, so the query can´t get an valid result and so the num_rows can´t be counted.