The problem, people, is that there is no column defined in the where clause: $link_id is not a valid column name, it is an undefined variable, so of course the query fails; probably with an error message something like this
you have an error in your sytax, check the manual for the correct syntax to use near
'WHERE = 4'
or whatever $id happens to be. See, no column name to compare it to.