Order text of database result
Moderator: General Moderators
Re: Order text of database result
From my free test webhost: PHP version 5.2.*
So, is there an other solution?
Re: Order text of database result
Nobody knows? I need it as fast as possible.
Re: Order text of database result
Can't it be done with substrings?
Re: Order text of database result
There are 10 types of people in this world, those who understand binary and those who don't
Re: Order text of database result
I can see that it outputs this:
[year] => 2006
[month] => 12
[day] => 12
But that is not exactly what I want, can I modify that?
[year] => 2006
[month] => 12
[day] => 12
But that is not exactly what I want, can I modify that?
Re: Order text of database result
Yes, you can.stijn22 wrote:I can see that it outputs this:
[year] => 2006
[month] => 12
[day] => 12
But that is not exactly what I want, can I modify that?
There are 10 types of people in this world, those who understand binary and those who don't
Re: Order text of database result
strtotime() understands MySQL's date format, so this will work:
I also support the opinion of leaving the field as the DATE type. You can convert to a UNIX timestamp either with PHP's strtotime(), or MySQL's UNIX_TIMESTAMP() function, if you need a timestamp. The DATE type is much more readable if you're ever in the database manually.
Code: Select all
$date = date('d-m-Y',strtotime($list->datum));Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: Order text of database result
Thanks! It's is now working 
I also want to leave the field DATE type, since I can easely sort them by ASC when the field is DATE.
Thanks again all of you, I've learned some great new php stuff
I also want to leave the field DATE type, since I can easely sort them by ASC when the field is DATE.
Thanks again all of you, I've learned some great new php stuff