date field with order by direct in mysql displays a result and in php it comes out different

0

I'm trying to display a query ordered by the month of a field date , in phpmyadmin the query comes out right and when I display the result of the same query with php the date quit the correct order.

query:

"select calendario.id_calendario, calendario.id_download, eventos.id_evento, eventos.descricao, str_to_date(concat(dia, '/', mes, '/', ano) , '%d/%m/%Y') as data
from calendario 
inner join eventos on calendario.id_evento = eventos.id_evento
order by month(data) asc , eventos.descricao asc"

In mysql this displays (the correct one)

andinphpitdisplayslikethis

The only difference is that I format the date in php for dd/mm/aaaa but this is after the query, has anyone else gone through this?

    
asked by anonymous 08.02.2017 / 03:16

1 answer

2

I discovered the problem, it has nothing to do with php or mysql, I'm using bootstrap with datatables and the API always initialized by column 0 hence deactivating the parameters of the datatables worked. Thank you all for the help.

$('#tabela1').dataTable( {
    order: [],
    columnDefs: [ { orderable: false, targets: [0] } ]
});
    
08.02.2017 / 12:49