Puedes contar el total de registros que te arroja tu consulta:
Código PHP:
$result = mysql_query("select * from busqueda where link = '$links[$i]'",$link);
if (mysql_num_rows($result)==0){
// registro no existe .. haz tu INSERT aquí ...
}
También puedes usar SQL .. con su comando COUNT() que es mucho más optimo para este tipo de cosas .. sobre todo cuando no requieres nada de ese registro por qué sólo andas buscando su existencia bajo el valor de algun campo ...
Código PHP:
$result = mysql_query("select COUNT(*) from busqueda where link = '$links[$i]'",$link);
if (mysql_result($result,0)==0){
// registro no existe .. haz tu INSERT aquí ...
}
Un saludo,