Rename $link to $conn. Fixed typos.