utilizza
quando inserisci
htmlentities("$link", ENT_QUOTES);


html_entity_decode(datiletturadb) quando stampi il risultato della query di lettura