Cosa contiene $valore? prova anche al posto della if(!$res) mettere solo:

$res = mysql_query($sql) OR DIE(mysql_error());