Ciao a tutti, vorrei fare l'update di un campo della tabella purchè il valore non sia già presente nella tabella stessa.
Pensavo di risolvere così:
$query = mysql_query("UPDATE utenti SET utentiLOGIN = '".$_REQUEST['f_codice']."' WHERE utentiID = '".$_SESSION['codiceUtente']."'
AND utentiLOGIN AND NOT EXISTS (SELECT utentiLOGIN FROM utenti WHERE utentiLOGIN = '".$_REQUEST['f_codice']."')") or die("Errore Riga 60: " . mysql_error());
L'errore è:
You can't specify target table 'utenti' for update in FROM clause
Ho cercato un po' sul forum ma non ho trovato casi analoghi.
Grazie