la notazione giusta è where id='$id'
così come me lo hai dato va in errore