Io ho un input di tipo testo, che con un form il contenuto di questo viene inviato al database, e fin qui tutto liscio, ma se io volessi inserire una cosa del genere per esempio 'dfg'dfgdf'gdfgd'&' mysql mi da errore:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'dfg'dfgdf'gdfgd'&' WHERE IDU='1'' at line 1

Qui vi allego il mio script!

Codice PHP:
function io() {
        global 
$idu$io;
        if (isset(
$_POST['io'])) {
            
$io $_POST['io'];
            if (
$io!='') {
                
mysql_query("UPDATE io SET TESTO='$io' WHERE IDU='$idu'")
                    or die (
mysql_error());
            }
        }
    }