This is good to know
But how is it possible that the same query, run from Phpmyadmin and from my PHP code, returns different results?
If I had noticed it before I would have written it in my first post, but I just realized it after your question 
When asked for insert statements they would look similar to:
INSERT INTO yourtablename VALUES (1,'something here','anotherfield');
INSERT INTO yourtablename VALUES (13,'larry,','curlymoe');
This is the section of the PHP code which handles the insert:
$sql="INSERT INTO appuntamenti (nome, tipo, indirizzo, cf, piva, referente, telefono, telefono2, referente2, telefono3, telefono4, via, num, comune, provincia, cap, regione, data, datafissaggio, organizzatore, relatore, relatoreinaffiancamento, omaggistica, numomaggi, coppie, persone, contributoacoppia, contributototale, pagamento, postdatato, storno, iban, beneficiario, numordini, note)
VALUES
('" . $_POST['nome'] . "','" . $_POST['tipo'] . "','" . $_POST['indirizzo'] . "','" . $_POST['cf'] . "','" . $_POST['piva'] . "',
'" . $_POST['referente'] . "',
'" . $_POST['telefono'] . "',
'" . $_POST['telefono2'] . "',
'" . $_POST['referente2'] . "',
'" . $_POST['telefono3'] . "',
'" . $_POST['telefono4'] . "',
'" . $_POST['via'] . "','" . $_POST['num'] . "','" . $_POST['comune'] . "','" . $_POST['provincia'] . "','" . $_POST['cap'] . "',
'" . $_POST['regione'] . "','" . $_POST['data'] . "',
'" . $_POST['datafissaggio'] . "',
'" . $_POST['organizzatore'] . "',
'" . $_POST['relatore'] . "','" . $_POST['relatoreinaffiancamento'] . "',
'" . $_POST['omaggistica'] . "',
'" . $_POST['numomaggi'] . "',
'" . $_POST['coppie'] . "',
'" . $_POST['persone'] . "',
'" . $_POST['contributoacoppia'] . "',
'" . $_POST['contributototale'] . "',
'" . $_POST['pagamento'] . "',
'" . $_POST['postdatato'] . "',
'" . $_POST['storno'] . "',
'" . $_POST['iban'] . "',
'" . $_POST['beneficiario'] . "',
'" . $_POST['numordini'] . "',
'" . $_POST['note'] . "')";
I’ve tried it in both. Phpmyadmin returns the results in the correct order (both if I use ASC or DESC). My PHP code returns wrong results in both cases.