Ciao a tutti , volevo utilizzare le funzioni DATE_FORMAT() e STR_TO_DATE() per la formattazione delle date da AAAA-MM-GG a GG-MM-AAAA e viceversa ma non ci sono riuscita .

La parte di codice con la SELECT che uso e:
leggi.php
Codice PHP:
    if(true) {
        
$sql_order "ORDER BY data DESC";
    } else {
        
$sql_order "ORDER BY data DESC";
    }

if (
$alphabet) {
    
$sql "SELECT DISTINCT $table.* FROM $base_from_where AND LEFT(data,1) = '$alphabet' ".$sql_order;
  } else{
    
$sql "SELECT DISTINCT $table.* FROM $base_from_where ".$sql_order;
    }
    
$result mysql_query($sql);
    
$resultsnumber mysql_numrows($result); 
Mentre per l'INSERT e:
scrivi.php
Codice PHP:
        $sql "INSERT INTO $table (nome,    data,   citta,    indirizzo,    created, modified)
                        VALUES ('
$nome','$data', '$citta', '$indirizzo', now(),   now())";
    
$result mysql_query($sql); 
Ho provato con :
Codice PHP:
    if(true) {
        
$sql_order "ORDER BY data DESC";
    } else {
        
$sql_order "ORDER BY data DESC";
    }

if (
$alphabet) {
    
$sql "SELECT DISTINCT $table.* FROM $base_from_where AND LEFT(data,1) = '$alphabet' ".$sql_order;
  } else{
    
$sql "SELECT DISTINCT $table.* FROM $base_from_where ".$sql_order;
    }
    
$result mysql_query($sqlDATE_FORMAT(data'%d %m %y'));
    
$resultsnumber mysql_numrows($result); 
Codice PHP:
        $sql "INSERT INTO $table (nome,    data,   citta,    indirizzo,    created, modified)
                        VALUES ('
$nome','$data', '$citta', '$indirizzo', now(),   now())";
    
$result mysql_query($sqlSTR_TO_DATE(data'%d %m %y')); 
ma nulla, la data non viene inserita nel campo di tipo DATE nel db e non viene letta .
Premetto che le due parti di codice originali mi funzionano ma mi danno come formattazione quella inglese (AAAA-MM-GG).
Sono sicura che sbaglio nell'usare le due funzioni...

Grazie in anticipo a chi rispondera'
Saluti
Milena