Just a tip, since you are learning. Keep your code clean, this is very sloppy, and if you were writing wordpress plugins for example, they'd laugh at that, no offense. Just write it in one line. It took you twice the time to code that than it should have. Time is important in this business. Also, learn to wrap strings and such in single quotes, so yu do not have to backslash as often.
Code:
$sql = 'SELECT `Link`,COUNT(Link) AS NumOccurrences FROM `Web2` GROUP BY `Link` HAVING ( COUNT(Link) > 1 )';
Much easier to read and less time to code. Always put this at the end of your queries, or a custom error logging function...