It's going to be one of the mysql functions which returns a "resource" type that is the culprit.
For instance, mysql_connect returns a "resource" type.
resource mysql_connect ([ string $server = ini_get("mysql.default_host") [, string $username = ini_get("mysql.default_user") [, string $password = ini_get("mysql.default_password") [, bool $new_link = false [, int $client_flags = 0 ]]]]] )
Any of the other MySQL functions which return a resource rather than a PHP data type could also be the cause.
mysql_query is another example.
resource mysql_query ( string $query [, resource $link_identifier ] )
"resource id #nn" is what you get if you convert a "resource" to a string, which is what happens when you try to print/etc the resource.
What I think is happening, is that you may be assigning the result from one of these resource returning functions to a variable somewhere, for example,
$conn = mysql_connect(...);
Then, somewhere along the line the variable is being printed. Maybe for a debugging purpose that someone missed during a cleanup.
--
What I would do is go through the list of MySQL functions and gather tha names of everything that returns a resource type. That should narrow down the suspects considerably.
Then, I would grep/findstr the scripts files looking for these function names. Making sure to include filenames and line numbers in my grep/findstr output so I can go directly to the spot and inspect it.
If you pipe the output for your grep/findstr search to another file, you'll have a nice list if places in the code you can inspect one by one. You will likely be able to rule out quite a few of them just by looking at the line in the grep/findstr output.
Strong with this one, the sudo is.